1、使用HttpServletRequest获取
@RequestMapping("/login.do")public String login(HttpServletRequest request){String name = request.getParameter("name")String pass = request.getParameter("pass")}
2、自动注入Bean属性
//封装的User类 public class User{private String name;private String pass;}
form表单提交的参数自动注入到User里面去,可以使用User里的get方法获取值
@RequestMapping("/login.do")public String login(User user) {syso(user.getName());syso(user.getPass());}