Tuesday, October 11, 2005

Struts and Indexed Properties

http://www.developer.com/java/ejb/article.php/2233591

http://struts.apache.org/faqs/indexedprops.html

Check those links in case you have an indexed property (like an array or list). It is very useful when you have a table that you want struts to link their properties automatically to the form.

In my case, it is a list (java.util.List) of item beans in the form that is iterated in the JSP, like this:

<logic:iterate id="items" name="orderEditForm" property="items">

<html:text name="items" indexed="true" property="product"/>
<html:text name="items" indexed="true" property="quantity"/>
<html:text name="items" indexed="true" property="amount"'/>

</logic:iterate>

This "items" property is defined in the orderEditForm as a List. Note the "indexed" property of html:text element.
Post a Comment