- This topic has 3 replies, 2 voices, and was last updated 20 years, 2 months ago by Riyad Kalla.
-
AuthorPosts
-
esweargMemberDear Mr.Kalla!
Thanq for replying my post.
here iam posting the entire code [as an attachment]of the pagePlz help me to fix the bug
thanking you
eswar<AddUserData.jsp>
in code page iam replacing <%,%>,<,> with 2 dots[..],
becoz when iam posting the exact page itz not accepting.Code Follows..
..@ page language=”java”..
..@ taglib uri=”http://jakarta.apache.org/struts/tags-bean” prefix=”bean” ..
..@ taglib uri=”http://jakarta.apache.org/struts/tags-html” prefix=”html” ..
..@ taglib uri=”http://jakarta.apache.org/struts/tags-logic” prefix=”logic” ..
..@ taglib uri=”http://jakarta.apache.org/struts/tags-tiles” prefix=”tiles” ..
..@ taglib uri=”http://jakarta.apache.org/struts/tags-template” prefix=”template” ..
..@ taglib uri=”http://jakarta.apache.org/struts/tags-nested” prefix=”nested” ....@ page import=”com.planters.hibernate.UsersService”..
..@ page import=”java.util.List”....!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”..
..html:html locale=”true”..
..head..
..html:base /....title..Users Example../title..
..meta http-equiv=”pragma” content=”no-cache”..
..meta http-equiv=”cache-control” content=”no-cache”..
..meta http-equiv=”expires” content=”0″..
..meta http-equiv=”keywords” content=”keyword1,keyword2,keyword3″..
..meta http-equiv=”description” content=”This is my page”..
../head....body..
..h3..Users Example../h3..
..html:errors/....
// This code will Generate a list of objects from the
// database and place a reference to this list in the
// request object
List usersList= UsersService.getInstance().getUsersList();
request.setAttribute(“vipdatas”,usersList);..
..p..List of Users In ..code..Users../code.. table of database ..code..User Info ../code…../p..
..table border=”1″..
..logic:iterate id=”element” name=”vipdatas” scope=”request” type=”com.planters.hibernate.Users”..
..tr..
..td….bean:write name=”element” property=”UName”/…./td..
..td….bean:write name=”element” property=”PWord”/…./td..
..td….bean:write name=”element” property=”Permitions”/…./td..
../tr..
../logic:iterate..
../table..
..p..Submit to Add a User:../p..
..!– This form will post the submitted data to the AddUsersData action Mapping –..
..html:form action=”AddUsersData.do” method=”post”..
..table border=”1″..
..tr….td..User Name:../td….td….html:text property=”UName” /…./td..
..td..Password:../td….td….html:text property=”PWrod” /…./td…./tr..
..td..Permitions:../td….td….html:text property=”Permitions” /…./td…./tr..
../table….br/..
..html:submit/..
../html:form..../body..
../html:html..
Riyad KallaMember😐
Please repost the code using code tags wrapping the code, please hit “Post Reply” and click the “Code” button to get the necessary tags to wrap your code.
Also can you explain what your problem is again? We handle a lot of questions a day, and its hard to keep them all straight at times exactly what the issue is.
esweargMemberHi!
Iam new to struts,iam learing struts using myeclips.i was going through the Hibernate demo recording and made a BasicDB project.
so far everything is fine.when i run the project iam getting a message like <vipdatas no bean found>.can any one plz tell me how do i can sort it out.
where do i can set <vipdatas>.
–>in AddUserData.jsp[AddVipData.jsp].
code is:[%@ page language="java"%] [%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %] [%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %] [%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %] [%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %] [%@ taglib uri="http://jakarta.apache.org/struts/tags-template" prefix="template" %] [%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %] [%@ page import="com.planters.hibernate.UsersService"%] [%@ page import="java.util.List"%] [html:html locale="true"] [head] [html:base /] [title]Users Example[/title] [meta http-equiv="pragma" content="no-cache"] [meta http-equiv="cache-control" content="no-cache"] [meta http-equiv="expires" content="0"] [meta http-equiv="keywords" content="keyword1,keyword2,keyword3"] [meta http-equiv="description" content="This is my page"] [/head] [body] [h3]Users Example[/h3] [html:errors/] [% // This code will Generate a list of objects from the // database and place a reference to this list in the // request object List usersList= UsersService.getInstance().getUsersList(); request.setAttribute("vipdatas",usersList); %] [p]List of Users In Users table of database User Info .[/p] [table border="1"] [logic:iterate id="element" name="vipdatas" scope="request" type="com.planters.hibernate.Users"] [tr] [td][bean:write name="element" property="UName"/][/td] [td][bean:write name="element" property="PWord"/][/td] [td][bean:write name="element" property="Permitions"/][/td] [/tr] [/logic:iterate] [/table] [p]Submit to Add a User:[/p] [!-- This form will post the submitted data to the AddUsersData action Mapping --] [html:form action="AddUsersData.do" method="post"] [table border="1"] [tr][td]User Name:[/td][td][html:text property="UName" /][/td] [td]Password:[/td][td][html:text property="PWrod" /][/td][/tr] [td]Permitions:[/td][td][html:text property="Permitions" /][/td][/tr] [/table][br/] [html:submit/] [/html:form] [/body] [/html:html]
Error Message..
javax.servlet.ServletException: Cannot find bean vipdatas in scope request
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:673)
org.apache.jsp.AddUserData_jsp._jspService(AddUserData_jsp.java:205)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)root cause
javax.servlet.jsp.JspException: Cannot find bean vipdatas in scope request
org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:940)
org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:277)
org.apache.jsp.AddUserData_jsp._jspService(AddUserData_jsp.java:142)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)note The full stack trace of the root cause is available in the Tomcat logs.
——————————————————————————–
Apache Tomcat/5.0.12
Riyad KallaMemberThis code looks perfectly fine… the only thing I can think of, is if vipdatas is null when it returns from the method call, and you are setting a null in the request scope… you can add a printout there to check it.
-
AuthorPosts