You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brian McSweeney <br...@aurium.net> on 2003/04/16 12:07:28 UTC

iterate tag problems

Hi all,

I'm iterating over a collection and trying to put the index of the collection as the 
value of a drop down list. It's causing me major headaches!

I have tried both of these approaches:

a)

<html:select name="myForm" property="setMe">
    <logic:iterate id="myInstance" indexId="myIndex" name="myForm" property="myCollection">
        <html:option value="<%=myIndex.intValue()%>">
            <bean:write name="myInstance"/>
        </html:option>
    </logic:iterate>
 </html:select>

b)

<html:select name="myForm" property="setMe">
    <logic:iterate id="myInstance" indexId="myIndex" name="myForm" property="myCollection">
        <html:option value="myIndex">
            <bean:write name="myInstance"/>
        </html:option>
    </logic:iterate>
 </html:select>

neither of these work.

anyone have any idea how to do it?

thanks,
Brian

Re: iterate tag problems

Posted by Brian McSweeney <br...@aurium.net>.
Thanks Jesse,
I'm getting different errors at least now. :-)

HTTP ERROR: 500 Cannot find bean instance in any scope

using the following code

<html:select name="myForm" property="myProperty">
    <logic:iterate id="instance" indexId="myIndex" name="myForm"
property="myCollection">
        <html:option value='<bean:write name="myIndex"/>'>
            <bean:write name="instance"/>
        </html:option>
    </logic:iterate>
</html:select>

I reckon I might not understand the iterator tag, but I thought you
could give any name to the id parameter. Is this incorrect?
thanks for your help,
Brian

----- Original Message -----
From: "Jesse Vitrone" <je...@vitalworks.com>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Wednesday, April 16, 2003 2:12 PM
Subject: RE: iterate tag problems


> What kind of errors are you getting?
>
>
> Maybe try using:
>
> <html:option value="<bean:write name="myIndex"/>">
>
>
> Just a guess.
>
>
>
> -----Original Message-----
> From: Brian McSweeney [mailto:brian.mcsweeney@aurium.net]
> Sent: Wednesday, April 16, 2003 6:07 AM
> To: Struts Users Mailing List
> Subject: iterate tag problems
>
>
> Hi all,
>
> I'm iterating over a collection and trying to put the index of the
> collection as the
> value of a drop down list. It's causing me major headaches!
>
> I have tried both of these approaches:
>
> a)
>
> <html:select name="myForm" property="setMe">
>     <logic:iterate id="myInstance" indexId="myIndex" name="myForm"
> property="myCollection">
>         <html:option value="<%=myIndex.intValue()%>">
>             <bean:write name="myInstance"/>
>         </html:option>
>     </logic:iterate>
>  </html:select>
>
> b)
>
> <html:select name="myForm" property="setMe">
>     <logic:iterate id="myInstance" indexId="myIndex" name="myForm"
> property="myCollection">
>         <html:option value="myIndex">
>             <bean:write name="myInstance"/>
>         </html:option>
>     </logic:iterate>
>  </html:select>
>
> neither of these work.
>
> anyone have any idea how to do it?
>
> thanks,
> Brian
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: iterate tag problems

Posted by Jesse Vitrone <je...@vitalworks.com>.
What kind of errors are you getting?


Maybe try using:

<html:option value="<bean:write name="myIndex"/>">


Just a guess.



-----Original Message-----
From: Brian McSweeney [mailto:brian.mcsweeney@aurium.net] 
Sent: Wednesday, April 16, 2003 6:07 AM
To: Struts Users Mailing List
Subject: iterate tag problems


Hi all,

I'm iterating over a collection and trying to put the index of the
collection as the 
value of a drop down list. It's causing me major headaches!

I have tried both of these approaches:

a)

<html:select name="myForm" property="setMe">
    <logic:iterate id="myInstance" indexId="myIndex" name="myForm"
property="myCollection">
        <html:option value="<%=myIndex.intValue()%>">
            <bean:write name="myInstance"/>
        </html:option>
    </logic:iterate>
 </html:select>

b)

<html:select name="myForm" property="setMe">
    <logic:iterate id="myInstance" indexId="myIndex" name="myForm"
property="myCollection">
        <html:option value="myIndex">
            <bean:write name="myInstance"/>
        </html:option>
    </logic:iterate>
 </html:select>

neither of these work.

anyone have any idea how to do it?

thanks,
Brian


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org