spring整合jdbc时候写的代码
Controller部分:
@RequestMapping("/emp/update")
public String update(Emp emp){
dao.update(emp);
return "redirect:../emp/list.do";
}
jsp部分:
<%@page pageEncoding="utf-8" contentType="text/html;charset=utf-8" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<title>表单标签-更新初始显示</title>
<body>
<form:form action="../emp/update.do" method="post" commandName="emp">
<form:hidden path="empno"/>
姓名:<form:input path="ename"/> <br>
职位:<form:select path="job" >
<form:option value="SALESMAN" label="SALESMAN" />
<form:option value="MANAGER" label="MANAGER" />
<form:option value="CLERK" label="CLERK" />
<form:option value="PRESIDENT" label="PRESIDENT" />
<form:option value="ANALYST" label="ANALYST" />
</form:select> <br>
管理者:<form:input path="mgr"/> <br>
入职时间:<form:input path="hiredate"/> <br>
工资:<form:input path="sal"/> <br>
奖金:<form:input path="comm"/> <br>
所在部门:<form:select path="deptno" items="${deptMap}"/><br>
<input type="submit" value="修改">
</form:form>
</body>
</html>
Controller部分:
@RequestMapping("/emp/update")
public String update(Emp emp){
dao.update(emp);
return "redirect:../emp/list.do";
}
jsp部分:
<%@page pageEncoding="utf-8" contentType="text/html;charset=utf-8" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<title>表单标签-更新初始显示</title>
<body>
<form:form action="../emp/update.do" method="post" commandName="emp">
<form:hidden path="empno"/>
姓名:<form:input path="ename"/> <br>
职位:<form:select path="job" >
<form:option value="SALESMAN" label="SALESMAN" />
<form:option value="MANAGER" label="MANAGER" />
<form:option value="CLERK" label="CLERK" />
<form:option value="PRESIDENT" label="PRESIDENT" />
<form:option value="ANALYST" label="ANALYST" />
</form:select> <br>
管理者:<form:input path="mgr"/> <br>
入职时间:<form:input path="hiredate"/> <br>
工资:<form:input path="sal"/> <br>
奖金:<form:input path="comm"/> <br>
所在部门:<form:select path="deptno" items="${deptMap}"/><br>
<input type="submit" value="修改">
</form:form>
</body>
</html>