十一、使用@RequestParam注解指定参数的name
十一、使用@RequestParam注解指定参数的name
https://www.cnblogs.com/sunniest/p/4555801.html
@Controller
@RequestMapping("/test")
public class mvcController1 {
@RequestMapping(value="/param")
public String testRequestParam(@RequestParam(value="id") Integer id,
@RequestParam(value="name")String name){
System.out.println(id+" "+name);
return "/hello";
}
}
// http://localhost:8080/HiSpringMVC/jim/param?id=1&name=Green //http://localhost:8080/HiSpringMVC/jim/param?id=21&name=Geek @RequestMapping(value="/param") public String testRequestParam(@RequestParam(value="id") Integer id, @RequestParam(value="name")String name){ System.out.println(id+" "+name); return "hello"; }
//@RequestParam(value="id") Integer id // http://localhost:8080/HiSpringMVC/jim/param?id=1&name=Green //http://localhost:8080/HiSpringMVC/jim/param?id=21&name=Geek // //http://localhost:8080/HiSpringMVC/jim/param?NO=21&name=Geek @RequestMapping(value="/param") public String testRequestParam(@RequestParam(value="NO") Integer id, @RequestParam(value="name")String name){ System.out.println(id+" "+name); return "hello"; }


浙公网安备 33010602011771号