关于s2sh表单更新问题

fage10900810 2012-05-12 09:43:40
页面
<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值为空,求高手指点下这是为啥呢?
...全文
40 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧