You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by XCoder Nitin <ni...@gmail.com> on 2011/02/16 14:14:51 UTC
Re: Nested Struts2 iterator tags
This is how the JSP code will look like:
<s:form action="saveaction" >
<s:iterator value="lstBean" id="lstBean" status="outerStat">
<s:textfield value="%{name}"
name="lstBean[%{#outerStat.index}].name"/>
<s:textfield value="%{amt}"
name="lstBean[%{#outerStat.index}].amt"/>
<s:textfield value="%{id}"
name="lstBean[%{#outerStat.index}].id"/>
<s:iterator value="%{lstString}" status="myStat">
<s:textfield
name="lstBean[%{#outerStat.index}].lstString[%{#myStat.index}]"/>
</s:iterator>
</s:iterator>
<s:submit value="Click me to submit lstBean"/>
</s:form>
Following is the bean(XBean) whose List is used in the JSP:
public class XBean
{
private ArrayList<String> lstString=new ArrayList<String>();
private String name;
private Double amt;
private Integer id;
//Getters and setters of fields
}
Now you can simply have a field lstBean with setters in your submitting
action (saveaction) and hey you are done.
--
View this message in context: http://old.nabble.com/Nested-Struts2-iterator-tags-tp23656304p30936628.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org