【发布时间】:2013-10-09 21:23:57
【问题描述】:
我有一个 JSP,我在其中迭代一个列表并创建一个可编辑的表。
<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>
我的清单:
List<Country> test = new ArrayList<Country>();
国家级:
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 的值时,我应该在我的操作中获得更新后的值。但我不能吗。有什么方法可以获取这些更新的值。
【问题讨论】:
-
struts 使用 %{variableName} 吗?
-
是的...它支持 OGNL 表达式
-
所以不应该是 ${variableName}
-
应该是....但是 %{variableName} 也可以工作..我在 jsp 中获取值..但是当我更新值并提交表单时,我没有得到更新的值在行动中
标签: java jsp struts2 annotations type-conversion