indexId will do
http://struts.apache.org/userGuide/struts-logic.html#iterate

<select name="..." >
 <logic:iterate id="element" name="showFacilitiesArray" indexId="index">
 <option value="<bean:write name="index"/>"><bean:write
name="element"/></option>
</logic:iterate> 
</select>

You may also want to look at html:options and html:optionsCollection

This would make above code a two-liner, and work with action forms.

Regards
Leon

> -----Ursprüngliche Nachricht-----
> Von: news [mailto:[EMAIL PROTECTED] Im Auftrag von Andre Bonhote
> Gesendet: Mittwoch, 6. April 2005 13:21
> An: user@struts.apache.org
> Betreff: <logic:iterate> and field indices
> 
> Hi!
> 
> I am quite new to Struts and to java, but I god hooked 
> (former addicted perl programmer). Please keep this in mind 
> before newbie-bashing me ;-)
> 
> In my project, I have some application wide settings, 
> launched using web.xml's <load-on-startup>1</load-on-startup> 
> thing. This loaded class populates some attributes with 
> values for later use. One of the attributes for example is 
> holding a String[].
> 
> Now, in the jsp, I have this:
> 
> <logic:iterate id="element" name="showFacilitiesArray">
>      <bean:write name="element" /><br /> </logic:iterate>
> 
> This works fine so far, but because I'd like to put that into 
> a <select> form, I would like to go one step further: How do 
> I print out the index of the current field?
> 
> I mean, I could do it in a scriptlet with a simple for loop, 
> printing the i each time, but actually I would appreciate no 
> scriptlets at all.
> 
> Any hints here? Unfortunately it's not that easy to google 
> for that kind of information :-/
> 
> Thanks in advance!
> 
> André
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to