update修改


在login.html中写入

<td><a th:href="@{updates(userId=${userInfo.userId},userName=${userInfo.userName})}"><span th:text="${userInfo.userName}"></span></a></td>


controller.xml

 @RequestMapping(value = "/updates", method = RequestMethod.GET)

public String updateLogin(UserBean userBean,Model model) {

return "xiugai"; }

xiugai.html

<form  action="update" th:object="${userBean}" method="post">

<tr>  <td>ID:<input name="userId" type="text" th:value="${userBean.userId}"/></td>  </tr>

<tr>  <td> 用户名:<input name="userName" type="text"  th:value="${userBean.userName}"/></td></tr>

controller.xml

@RequestMapping(value = "/update", method = RequestMethod.POST)

public String update(UserBean userBean,Model model) {

int result=helloWorldService.update(userBean);

service.xml

public int update(UserBean frm) {

return updateDao.execute("User.userupdate",frm); }

usersqlmap.xml

<update id="userupdate"  parameterClass="cn.training.bean.UserBean">

UPDATE user SET  userName=#userName# ,userpassword=#userPassword# 

WHERE userid = #userId#

</update>




你可能感兴趣的:(update修改)