| Author |
Struts Logic Tag problem
|
John xux
Greenhorn
Joined: Mar 25, 2007
Posts: 2
|
|
I am using struts logic tag in a JSP page to retrieve and display an array of java beans. The array of java beans was added as an session attribute in the Action class. I am using the following code to display the java bean properties in the JSP. <logic:iterate id="record" name="studentinfo" scope="session" type="com.myapp.struts.StudentDAO"> <tr> <td><bean:write name="record" property="student_id"/></td> <td><bean:write name="record" property="first_name"/></td> <td><bean:write name="record" property="last_name"/></td> <td><bean:write name="record" property="student_status"/></td> <td><bean:write name="record" property="graduation_date"/></td> <td><bean:write name="record" property="availability"/></td> <td><bean:write name="record" property="department"/></td> <td><bean:write name="record" property="brief_desc"/></td> <td><bean:write name="record" property="phone"/></td> <td><bean:write name="record" property="testProperty"/></td> </tr> </logic:iterate> I get the following error javax.servlet.ServletException: Cannot find bean record in any scope org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) org.apache.jsp.displaystudentinfo_jsp._jspService(displaystudentinfo_jsp.java:194) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063) org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263) org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386) org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362) root cause I am able to access the array of java beans, iterate over each bean and display each property using jsp scriptlets. I am unable to do this using logic tags. What is causing this error? Please help understand the problem. Thanks
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
|
Try removing the type attribute from your logic:iterate tag.
|
Merrill
Consultant, Sima Solutions
|
 |
John xux
Greenhorn
Joined: Mar 25, 2007
Posts: 2
|
|
Thanks for the suggestion. There was no tag lib import statement in the jsp. I added it and it is working now.
|
 |
 |
|
|
subject: Struts Logic Tag problem
|
|
|