如何在我的操作中从JSP获取更新的列表值?
我有一个JSP,我在其中迭代列表并创建一个可编辑的表。
我的列表:
List test = new ArrayList();
国家级:
public class Country { private String countryCode; private String countryName; and the getter setters......
并说我填写列表如下:
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);
现在,当我在JSP中更改countrycode
和countryname
的值时,我应该在我的操作中获取更新的值。 但我无法做到。 有没有办法获得这些更新的值。
当params
拦截器使用索引属性访问填充列表时,您需要创建Country
对象。
要让struts填充列表,您应该在xml配置中使用类型转换注释或等效项。
@Element(value = Country.class) @Key(value = String.class) @KeyProperty(value = "countryCode") @CreateIfNull(value = true) private List countryList = new ArrayList ;