关于s2sh表单更新问题
页面
<s:form action="sjzdflAction.action" method="post" >
<s:iterator value="#request.allSjzdfl" id="allSjzdfl">
<tr bgcolor="#E3E3E3">
<td align="center">
<s:hidden value="sjzdflId"></s:hidden>
<s:property value="sjzdflId"/>
</td>
<td align="center">
<s:textfield name="sjzdflmc"></s:textfield>
</td>
</tr>
</s:iterator>
<s:submit name="save" value="保存" method="update"></s:submit>
action
private String sjzdflmc;
private Integer sjzdflId;
public String execute() throws Exception {
findall();
return SUCCESS;
}
public void findall()throws Exception{
List<Sjzdfl> allSjzdfl = sjzdflservice.findall();
HttpServletRequest request = ServletActionContext.getRequest();
request.setAttribute("allSjzdfl", allSjzdfl);
}
public void update()throws Exception{
Sjzdfl sjzdfl = new Sjzdfl();
sjzdfl.setSjzdflId(sjzdflId);
sjzdfl.setSjzdflmc(sjzdflmc);
sjzdflservice.update(sjzdfl);
}
pojo
private Integer sjzdflId;
private String sjzdflmc;
当我点击提交之后 会报错 bug跟了一下发现id值为空,求高手指点下这是为啥呢?