表单传值给@Controller
<form action="springmvc/testModelAttributes" method="post">
<input type="hidden" name="id" value="1"/>
username:<input type="text" name="username" value="Tom"/>
<br><br>
email:<input type="text" name="email" value="tom@atguigu.com"/>
<br><br>
age:<input type="text" name="age" value="12"/>
<br><br>
city:<input type="text" name=privnce value="beijing"/>
<br><br>
<input type="submit" value="Submit"/>
</form>
@RequestMapping("/testModelAttributes")
public String testModelAttributes(User user){
System.out.println("修改user信息:" + user);
return SUCCESS;
}
User会取form表单name为自己属性的属性值存储