I have a JSP in which I am iterating over a list and creating an editable table.
<s:iterator value="test" id="countryList">
<tr>
<td><s:textfield name="countryCode" value="%{countryCode}" theme="simple" /></td>
<td><s:textfield name="countryName" value="%{countryName}" theme="simple" /></td>
</tr>
</s:iterator>
My list:
List<Country> test = new ArrayList<Country>();
Country class:
public class Country {
private String countryCode;
private String countryName;
and the getter setters......
and say I populate the list like:
Country country = new Country();
Country country1 = new Country();
country.setCountryCode("1");
country.setCountryName("India");
country1.setCountryCode("2");
country1.setCountryName("US");
test.add(country);
test.add(country1);
Now when I change the values of countrycode
and countryname
in the JSP, I should get the updated values in my action. But am I not able to. Is there any way to get these updated values.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…