You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ajay Patil <ap...@vertex.co.in> on 2003/07/29 03:46:57 UTC
Example on submission of indexed properties
Dear ATTA,
Here is the example:
JSP Page
--------
<html:form name="TestForm" type="test.TestForm" action="/test">
<logic:iterate name="TestForm"
property="indexedBeans" id="indexedBeans"
<!-- Please note that id in logic:iterate tag should match
the name in html:text tag -->
<html:text name="indexedBeans" property="prop1" indexed="true" />
<html:text name="indexedBeans" property="prop2" indexed="true" />
</logic:iterate>
</html:form>
Form Class
----------
public ArrayList getIndexedBeans() {
return this.myBeans;
}
// THIS METHOD IS REQUIRED IF YOUR FORM IS OF REQUEST SCOPE.
public MyBean getIndexedBeans(int index) {
while (this.myBeans.size() + 1 < index)
this.myBeans.add(new MyBean());
return (MyBean) this.myBeans.get(index);
}
Bean Class
----------
public class MyBean {
private String prop1;
private String prop2;
public String getProp1() {
return prop1;
}
public void setProp1(String prop1) {
this.prop1 = prop1:
}
public String getProp1() {
return this.prop2;
}
public void setProp2(String prop2) {
this.prop2 = prop2;
}
}
----- Original Message -----
>From "atta-ur rehman" <at...@numetrics.com>
Date Mon, 28 Jul 2003 10:10:17 -0700
To "Struts Users Mailing List" <st...@jakarta.apache.org>
Subject Indexed Properties
> Dea all,
> I've been reading an indexed properties article at:
> http://jakarta.apache.org/struts/faqs/indexedprops.html
> Whereas this article shows how to read indexed properties in the JSP
> page it doesn't show how to submission of a JSP page will work with
> the indexed
> properties. I tried to submit my JSP page with indexed properties
> but it complains about non-existent getter/setter for the property.
> Now my question is: is it possible at to do submission on indexed
> properties? Any instructive example would be great!
> Regards,
> ATTA
> PS: Maybe Daivd M. Carr could throw some light on it!
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org