You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mark Ayad <ma...@javamark.com> on 2002/11/11 13:57:23 UTC

Re: Map-backed Iteration: Cannot create iterator for this collection

I get:

javax.servlet.jsp.JspException: Cannot create iterator for this collection

when now trying:

 <logic:iterate id="mymap" name="mapForm">
 </logic:iterate>

And using:
public class MapForm extends ActionForm
{
 private final Map values = new HashMap();

    public void setValue(String key, Object value) {
        values.put(key, value);
    }

    public Object getValue(String key) {
        return values.get(key);
    }

    public MapForm()
    {
     System.out.println("constructor called");

     values.put("foo","bar");
    }

    public Map getMyMap()
    {
     return values ;
    }
}

----- Original Message -----
From: "du Plessis, Corneil C" <CA...@sbic.co.za>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, November 11, 2002 1:15 PM
Subject: RE: Mab-backed Iteration


> I you want to iterate a Map you will have to expose a getMyMap or whatever
> the name of your proerty is.
> The documentation for logic:iterate is prettry straight-forward.
>
> -----Original Message-----
> From: Mark Ayad [mailto:mark@javamark.com]
> Sent: 11 November, 2002 13:21
> To: Struts Users Mailing List
> Subject: Mab-backed Iteration
>
>
>
> I would like to iterate the elements in a Map-backed action form in my
JSP.
> How do I get a handle on the Map used in the page a.k.a what do I use for
> the name="?????"
>
>
> <logic:iterate id="element" name="?????">
> Next element is <bean:write name="element" property="value"/>
> </logic:iterate>
>
> The Map Backed form bean is:
>
> public MapForm extends ActionForm {
>
>     private final Map values = new HashMap();
>
>     public void setValue(String key, Object value) {
>         values.put(key, value);
>     }
>
>     public Object getValue(String key) {
>         return values.get(key);
>     }
> }
>
>
> ______________________________________________
>
> Disclaimer and confidentiality note
>
>
> Everything in this e-mail and any attachments relating to the official
business of
> Standard Bank Group Limited is proprietary to the company. It is
confidential, legally
> privileged and protected by law. Standard Bank does not own and endorse
any other content.
> Views and opinions are those of the sender unless clearly stated as being
that of Standard Bank.
>
> The person addressed in the e-mail is the sole authorised recipient.
Please notify the sender
> immediately if it has unintentionally reached you and do not read,
disclose or use the content
> in any way.
>
> Standard Bank can not assure that the integrity of this communication has
been maintained nor
> that it is free of errors, virus, interception or interference.
>
> ______________________________________________
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>