其他分享
首页 > 其他分享> > 【SpringMVC】标签库:select

【SpringMVC】标签库:select

作者:互联网

@Controller
public class MyController {
	@RequestMapping(value="/click",method=RequestMethod.GET)
	public String selectForm(Model model)
	{
		User user= new User();
		user.setDeptId(2);
		
		model.addAttribute("user", user);
		return "result";
	}
}
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>

<body>

	<form:form modelAttribute="user" action="click" method="POST">
		<table>
			<tr>
				<td>111∶</td>
				<td>
				<td><form:select path="deptId">
						<form:option value="1">A</form:option>
						<form:option value="2">B</form:option>
						<form:option value="3">C</form:option>
					</form:select></td>
			</tr>
		</table>
	</form:form>

</body>
</html>

标签:SpringMVC,标签,addAttribute,user,model,public,select,User
来源: https://blog.csdn.net/wlc19981111/article/details/117072880