Acidburn 0 Posting Pro

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.