Stephen Turner
Mon, 01 Feb 2010 08:38:35 -0800
Hi, just a quick question. I have a class that has 4 fields. 2 Strings, 1 int, 1 boolean. I shall refer to this class as MyClassIn my Action class I have a List (call it MyList) that is a list of MyClass.It can be populated with as little as 1 item or as many as say 256 items (could be more but I'll keep this limit for simplicity). Iterating through MyList in a JSP with the struts tag <s:iterator........</s:iterator> is easy enough. My question is this....When I iterate through MyList in the JSP I'm setting form fields (of all 4 fields from MyClass). What would be the best way to get all that input backwhen I submit the form? Is there an example of this somewhere I haven't found or just a pretty straightforward way of doing this I'm not thinking of? Thanks, Craig
You just need to tell struts what type of objects are in the list: http://struts.apache.org/2.0.8/docs/type-conversion.htmlBasically this would involve a "Myaction-conversion.properties" file alongside the action class. It would contain:
Element_MyList=mypackage.MyClass Also, there's a pretty good section on this in "Struts in Action". Steve -- Stephen Turner Senior Programmer/Analyst - SAIS MIT IS&T --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org