java - struts2 populate "value" object of map from Form post -
i'm using struts 2. have object contains booleans. have hashmap contains many of previous objects defined key.
in jsp table populated radio buttons. 1 line each key of map etc. when post form want save options set user. map not seem populated.
my code like:
myobject ( 2 boolean parameters ) private map<string, myobject> ... (with getter & setter ).
in jsp html generated is:
<input type="radio" name="mymap[123].booleanparameter1" id="someid" checked="checked" value="true"> etc
can on how "name" of radio button should set struts can populate map?
public class myobject implements serializable{ private boolean booleanparameter1; private boolean booleanparameter2; getters & setters here }
map<string,myobject> mymap ... in action
jsp...
<s:iterator ...iterates default map values> <s:radio label="parameter1" name="mymap['%{key}'].booleanparameter1" list="#{'true':'yes','false':'no'}" value="%{value.booleanparameter1}" /> <s:radio label="parameter2" name="mymap['%{key}'].booleanparameter2" list="#{'true':'yes','false':'no'}" value="%{value.booleanparameter2}" /> </s:iterator>
solution found. class "myobject" did not have default constructor. struts/ognl needs default constructor create object.
Comments
Post a Comment