第六章 表单标签
SpringMVC也提供了一组类似JSTL的标签,供我们在页面上简化开发。下面是个例子:
<form:form action=" p a g e C o n t e x t . r e q u e s t . c o n t e x t P a t h / e m p " m e t h o d = " p o s t " m o d e l A t t r i b u t e = " e m p l o y e e " > < i n p u t t y p e = " h i d d e n " n a m e = " m e t h o d " v a l u e = " p u t " / > < f o r m : h i d d e n p a t h = " e m p I d " / > < t a b l e a l i g n = " c e n t e r " > < t r > < t d c o l s p a n = " 2 " a l i g n = " c e n t e r " > 编 辑 员 工 < / t d > < / t r > < t r > < t d > 姓 名 < / t d > < t d > < f o r m : i n p u t p a t h = " e m p N a m e " / > < / t d > < / t r > < t r > < t d > 社 会 保 险 号 < / t d > < t d > {pageContext.request.contextPath }/emp" method="post" modelAttribute="employee"> <input type="hidden" name="_method" value="put"/> <form:hidden path="empId"/> <table align="center"> <tr> <td colspan="2" align="center">编辑员工</td> </tr> <tr> <td>姓名</td> <td> <form:input path="empName"/> </td> </tr> <tr> <td>社会保险号</td> <td> pageContext.request.contextPath/emp"method="post"modelAttribute="employee"><inputtype="hidden"name="method"value="put"/><form:hiddenpath="empId"/><tablealign="center"><tr><tdcolspan="2"align="center">编辑员工</td></tr><tr><td>姓名</td><td><form:inputpath="empName"/></td></tr><tr><td>社会保险号</td><td>{requestScope.employee.ssn }
所在部门
<form:select path=“department.deptId” items="${requestScope.deptList }" itemValue=“deptId” itemLabel=“deptName”/>
</form:form>
1.导入标签库
<%@ taglib uri=“http://www.springframework.org/tags/form” prefix=“form” %>
2.form:form标签
更多内容请见原文,原文转载自:https://blog.csdn.net/weixin_44519496/article/details/120360901
标签:form,contextPath,Spring,表单,MVC,标签,employee,method From: https://www.cnblogs.com/wangchuanxinshi/p/16732169.html