- RequestParam来映射请求参数
- required表示是否必须,默认为true
- defaultValue请求参数的默认值
- @RequestMapping(value = "/testRequestParam")
- public String testRequestParam(@RequestParam(value="username")String un,@RequestParam(value = "age",required = false,defaultValue = "0") int age){
- System.out.println("testRequestParam,username:"+un+",age,"+age);
- return "success";
- }