(1)Get请求
- RequestParam:设置Get键值对
PathVariable:设置路径变量
/**
* Get请求 http://localhost:8080/get/login?name=tom&age=22
* @param name
* @param age
* @return
*/
@RequestMapping(value = "/get/login",method = RequestMethod.GET)
public String get(@RequestParam String name,@RequestParam int age){
logger.info(name);
logger.info(""+age);
return "SUCCESS";
}
/**
* Get请求 http://localhost:8080/tom/12
* @param name
* @param age
* @return
*/
@RequestMapping(value = "/{name}/{age}",method = RequestMethod.GET)
public String path(@PathVariable String name, @PathVariable int age){
logger.info(name);
logger.info(""+age);
return "Good";
}