Use the following setting
List<String> cdata = new ArrayList<String>(); public List<String> getCdata() { return cdata; } public void setCdata(final List<String> cdata) { if (cdata == null) { this.cdata = new ArrayList<String>(); } else { this.cdata = cdata; } }
represent values from the JSP, such as cdata [1] = value, etc.
The only requirement is to have getters / setters. I tested this Tomcat7 running on java 1.6. You can imagine values like cdata [0], cdata [1], as well as
otherwise you can use the card
private Map<String, String> data = new HashMap<String, String>(); public Map<String, String> getData() { return data; } public void setData(Map<String, String> data) { this.data = data; }
JSP may have
<s:form action="indexProperty"> <h3>Test The Map</h3> <input type="text" name="data['0']"/> <input type="text" name="data['1']"/> <s:iterator value="data.entrySet()" var="aData"> <s:property value="#aData.key" />-<s:property value="#aData.value" /> </s:iterator> <input type="submit" name="submit" value="submit"/> </s:form>
Gets the settlement no problem
source share