User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 375,170 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,237 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 1425 | Replies: 0 | Solved
Reply
Join Date: Dec 2004
Posts: 457
Reputation: Acidburn is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 5
Acidburn Acidburn is offline Offline
Posting Pro in Training

JSP iterator error with structs

  #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:

<%@ 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" %>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>

    <h1>JSP Page</h1>
    
    <jsp:useBean id="address" scope="session" class="Address.AddressForm">
        <logic:iterate id="myIterator" name="address"  type="Address.AddressDTO">
            <bean:write name="myIterator" property="addresses.name"/>
        </logic:iterate>
        
    </jsp:useBean>
    </body>
</html>
 

My action code: which is invoked before forwarding to this page - it should but the bean into scope:
import Data.MyFactory;
imports.........

public class AddressAction extends Action {
    public ActionForward execute(
            ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        //Returns a list of accidents and sets accidents attribute in session
        AddressDAO myDAO = MyFactory.getFactory("standard").getDAO(AddressDAO.class);
        request.setAttribute(MMIUtils.addresses,myDAO.retrieveAll());
        
        return mapping.findForward("success");
    }
}
 
the structs configuration file:

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

 static public String addresses = "addresses"; 

any ideas?
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JSP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 11:47 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC