JSP iterator error with structs

Thread Solved

Join Date: Dec 2004
Posts: 489
Reputation: Acidburn is an unknown quantity at this point 
Solved Threads: 5
Acidburn Acidburn is offline Offline
Posting Pro in Training

JSP iterator error with structs

 
0
  #1
Jun 6th, 2007
Hello there,

I've got some information which is stored in a class object, these objcts are transfered to an action in the format of a set.

I'm trying to put the set into a bean into my JSP, however im not having much luck.

The error is as follows:
org.apache.jasper.JasperException: Cannot create iterator for this collection
The JSP code:

  1. <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
  2. <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
  3. <%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
  4.  
  5. <html>
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  8. <title>JSP Page</title>
  9. </head>
  10. <body>
  11.  
  12. <h1>JSP Page</h1>
  13.  
  14. <jsp:useBean id="address" scope="session" class="Address.AddressForm">
  15. <logic:iterate id="myIterator" name="address" type="Address.AddressDTO">
  16. <bean:write name="myIterator" property="addresses.name"/>
  17. </logic:iterate>
  18.  
  19. </jsp:useBean>
  20. </body>
  21. </html>

My action code: which is invoked before forwarding to this page - it should but the bean into scope:
  1. import Data.MyFactory;
  2. imports.........
  3.  
  4. public class AddressAction extends Action {
  5. public ActionForward execute(
  6. ActionMapping mapping,
  7. ActionForm form,
  8. HttpServletRequest request,
  9. HttpServletResponse response) throws Exception {
  10. //Returns a list of accidents and sets accidents attribute in session
  11. AddressDAO myDAO = MyFactory.getFactory("standard").getDAO(AddressDAO.class);
  12. request.setAttribute(MMIUtils.addresses,myDAO.retrieveAll());
  13.  
  14. return mapping.findForward("success");
  15. }
  16. }
the structs configuration file:

  1. <action
  2. path="/AddressAction"
  3. type="Address.AddressAction">
  4. <forward name="success" path="/success.jsp"/>
  5. </action>
  6. </action-mappings>
and finally the MMIUtils contains this:

  1. static public String addresses = "addresses";

any ideas?
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for JSP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC