That works, thanks.
But does anyone have a Struts EL version? I prefer to go that route.
Thanks Victor
___
Sent with SnapperMail
www.snappermail.com

...... Original Message .......
On Sun, 3 Oct 2004 18:27:11 -0500 Hubert Rabago <[EMAIL PROTECTED]> wrote:
>I have to admit I always have trouble dealing with the iterate tag.  I
>recently rediscovered how easy it is to do these iterations using the
>nested tags.  Have you tried them?  Maybe something like this would
>work for you:
>
><html:form action="/test">
>       <nested:iterate property="list">
>               <nested:write property="id" /><br>
>               <nested:text property="description"
>onchange="changefield(this);"/><br>
>               <nested:hidden property="isChanged" /><br>
>       </nested:iterate>
>       <html:submit>Send</html:submit>
></html:form>
>
>I don't know if it's considered "best practice" to also surround the
>form with <nested:form>, but I've tried using the basic <html:form>
>and it works fine, too.  The result is code I can actually understand.
>:)
>
>If you want to stick to the html tags, take a look at the example in
>http://wiki.apache.org/struts/StrutsCatalogLazyList
>
>hth,
>Hubert
>
>On Sun, 3 Oct 2004 14:16:19 -0400, Victor Grazi <[EMAIL PROTECTED]> wrote:
>> We are trying to use <logic:iterate> in a JSP to access items in a list
>> stored in the Form Bean by the Action class but we can't seem to get the
>> syntax right.
>> 
>> I am getting an error meessage from PropertyUtils that displays the 
index as
>> '${index}', which indicates that that struts el expression is not 
resolving
>> to an int.
>> 
>> Here is my exact syntax. The form and action are described in more detail
>> below.
>> 
>> <html:form action="/test">
>>        <logic:iterate id="lineItem" indexId="index" name="testForm"
>> property="list">
>> 
>>                <!-- display the index counter for the fun of it. This 
works
>> ok -->
>>                <bean:write name="index" /><br>
>> 
>>                <!-- now access the id of the indexth element of the list
>> -->
>>                <bean:write name="list[${index}].id" /><br>
>> 
>>                <!-- now access the description of the indexth element of
>> the list -->
>>                <html:text property="list[${index}].description"
>> onchange="changefield(this);"/><br>
>>                <html:hidden property="isChanged[${index}]" /><br>
>> 
>>        </logic:iterate>
>>        <html:submit>Send</html:submit>
>> </html:form>
>> 
>> I have created several Test classes to help me understand the flow...
>> 
>> The form is an instance of TestForm exends ActionForm and its form name 
in
>> struts-config.xml is "testForm". (This is the named form for the action.)
>> TestForm has one property: java.util.List list with accessors public List
>> getList() and public void setList(List list).
>> 
>> List is always a List of LineItem objects where LineItem is a simple
>> JavaBean with properties
>> String id (public String getId() and public void setId(String id)), 
String
>> description (public String getDescription() and public void
>> setDescription(String description)) and boolean isChanged (public void


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

Reply via email to