I am displaying an ArrayList of HashMap in JSP using logic:iterate.
action form (MyForm)
===========
private ArrayList myList = new ArrayList();
public ArrayList getMyList() {
return myList;
}
public void setMyList(ArrayList myList) {
this.myList = myList;
}
initial action
==============
ArrayList list = new ArrayList()
Map map = new HashMap()
map.put("ONE","OneOne")
map.put("TWO","OneTwo")
list.add(map);
map = new HashMap()
map.put("ONE","TwoOne")
map.put("TWO","TwoTwo")
list.add(map);
myForm.setMyList(list)
JSP
===
<table>
<logic:iterate id="myList" name="MyForm" property="myList" indexId="index">
<tr>
<td>
<html:text name="myList" property="ONE" indexed="true" />
</td>
<td>
<html:text name="myList" property="TWO" indexed="true" />
</td>
</tr>
</logic:iterate>
</table>
The display is OK as it shows all the contents of the list.
[OneOne] [TwoOne]
[OneTwo] [TwoTwo]
My problem is that if i modify the contents... for example i modified it as:
[A]
[C] [D]
then click a submit button, the changes are not reflected in the Action.
Please advise.
action form (MyForm)
===========
private ArrayList myList = new ArrayList();
public ArrayList getMyList() {
return myList;
}
public void setMyList(ArrayList myList) {
this.myList = myList;
}
initial action
==============
ArrayList list = new ArrayList()
Map map = new HashMap()
map.put("ONE","OneOne")
map.put("TWO","OneTwo")
list.add(map);
map = new HashMap()
map.put("ONE","TwoOne")
map.put("TWO","TwoTwo")
list.add(map);
myForm.setMyList(list)
JSP
===
<table>
<logic:iterate id="myList" name="MyForm" property="myList" indexId="index">
<tr>
<td>
<html:text name="myList" property="ONE" indexed="true" />
</td>
<td>
<html:text name="myList" property="TWO" indexed="true" />
</td>
</tr>
</logic:iterate>
</table>
The display is OK as it shows all the contents of the list.
[OneOne] [TwoOne]
[OneTwo] [TwoTwo]
My problem is that if i modify the contents... for example i modified it as:
[A]
[C] [D]
then click a submit button, the changes are not reflected in the Action.
Please advise.