可以在业务控制方法中,以参数形式收集客户端参数,springmvc采用方法参数形式的
@Controller @RequestMapping(value="/user") public class UserAction{ @RequestMapping(value="/add") public String add(Model model,int id,String name,Double sal) throws Exception{ System.out.println("HelloAction::add()"); System.out.println(id + ":" + name + ":" + sal); model.addAttribute("message","增加用户"); return "/success.jsp"; } }
http://127.0.0.1:8080/myspringmvc/user/add.action?id=1&name=zhaojun&sal=5000