Hi all,
There's an array with variable length, I want to use it in order to create some <html:text> tags with indexed property, so I use a tag like what follows:
<logic:iterate name="theArray" id="element" indexId="index">
I tried following tag to create text input fields
<html:text property="theArray[index].propertyName" />
but an IllegalArgumentException occurs when I run the application.
What is the correct <html:text> with an indexed property to be nested in the <logic:iterate> tag?
Thanks
Majid Makki
-
Struts: Indexed Properties in an Iterate tage? (3 messages)
- Posted by: Majid Makki
- Posted on: August 16 2004 07:34 EDT
Threaded Messages (3)
- Struts: Indexed Properties in an Iterate tage? by Rene Zanner on August 16 2004 08:37 EDT
- A solution by Lucas Fabiano on September 18 2009 16:06 EDT
- Struts: Indexed Properties in an Iterate tage? by Andreas Koop on August 16 2004 17:52 EDT
-
Struts: Indexed Properties in an Iterate tage?[ Go to top ]
- Posted by: Rene Zanner
- Posted on: August 16 2004 08:37 EDT
- in response to Majid Makki
Hi,
the iterate tag stores the current iteration element in a page context variable with the name "id". So you can use it directly:
<logic:iterate name="theArray" id="element">
<html:text name="element" property="propertyName"/>
</logic:iterate>
Hope that helps,
René Zanner -
A solution[ Go to top ]
- Posted by: Lucas Fabiano
- Posted on: September 18 2009 16:06 EDT
- in response to Rene Zanner
If you need to get the value, you try to document.form[0][fieldName] -
Struts: Indexed Properties in an Iterate tage?[ Go to top ]
- Posted by: Andreas Koop
- Posted on: August 16 2004 17:52 EDT
- in response to Majid Makki
Hi,
try the following:
<html:text property='<%= "theArray[" + index + "].propertyName" %>'/>
or if you want to avoid the pain with the notation
user struts-el:
<html:text property="theArray[${index}].propertyName"/>
you can read mor about indexed properties at http://struts.apache.org/faqs/indexedprops.html
hope this helps,
Andreas.