1.直接将表单中的数据写入形参中
@RequestMapping public String showIndex(String name,String pass){ System.Out.Println("name:"+name); System.Out.Println("pass:"+pass); }
2.使用HttpServletRequest
@RequestMapping("/") public String showIndex(HttpServletRequest req) { String name = req,getParmeter("name"); String pass = req.getParmeter("pass"); }
3.使用和保单数据一样的javaBean
class ModelMap{ private String name; private String pass; } @RequestMapping("/") public String showIndex(ModelMap model) { syso(model.name); syso(model.pass); }