<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%--
Created by IntelliJ IDEA.
User: TeduJAVA
Date: 2019/3/20
Time: 15:53
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<form:form action="/user/login" modelAttribute="SE_USER" method="post">
<input type="text" name="name"><br>
<input type="password" name="password"><br>
<input type="submit" name="登录"><br>
</form:form>
</body>
</html>
@Controller
@RequestMapping("/user")
@SessionAttributes("SE_USER")
public class UserController {
@RequestMapping("/login")
@ModelAttribute
public String Login(@ModelAttribute("SE_USER") User user){
System.out.println("login...");
return "user";
}
}
@ModelAttribute标签应该如何使用?