Two things regarding using the "indexed" attribute of the Struts html:text 
tag.

First, there is a disagreement between the Struts FAQ on indexed properties 
and the Struts HTML tag docs.

The Struts FAQ
http://jakarta.apache.org/struts/faqs/indexedprops.html
states that setting indexed="true" results HTML "name" attribute of 
"name[nn].property", where name is the name attribute of the html:text tag 

The Struts HTML tag docs 
http://jakarta.apache.org/struts/struts-html.html#text
state that setting indexed="true" results in HTML "name" attribute of 
"id[34].propertyName", where id is an attibute in the logic:iterate tag.

I'm sure there are many situations where the logic:iterate "id" attribute 
value is the same as the html:text "name" attribute, but not always. Does 
anyone know which or these docs is the correct one ?


Second thing I'm confused about has to do with iterating over a collection of 
String objects using logic:iterate and the html:text "indexed" attribute set 
to true. I have scoured the mailing list archives and see plenty of 
discussion/examples about how to use these to iterate over a collection of 
beans --- the html:text tag would specify the desired property of the bean as 
the value of the "property" attribute. However, a String does not have 
properties, so I don't understand how to do it for a collection of Strings.

e.g. using the Struts FAQ stringbean bean as an example, I believe the 
following would successfully iterate over the LabelValue objects in the 
stringbean's lvbeans array, using the value of the label property for the 
html text tag.

<logic:iterate name="stringbean" property="lvbeans" id="labelValue">
  <html:text name="labelValue" property="label" indexed="true" />
</logic:iterate>

resulting in HTML "name" attribute of labelValue[nn].label


but, lets say I have an array of String objects (stringArray) instead of an 
array of beans, and tried the following:

<logic:iterate name="stringbean" property="stringArray" id="aString">
  <html:text name="aString" property="?????" indexed="true" />
</logic:iterate>

My goal is have this generate HTML text tags with "name" attribute of 
aString[0], aString[1], etc.
Since a String does not have a property, what would be used for the property 
value ??

Thanks for any help !

- Charlie



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

Reply via email to