版权声明:Arno https://blog.csdn.net/yu342107056/article/details/86420883
RESTFul风格的请求:
普通get请求:
Url:localhost:XXXX/addUser.action?name=tom&age=18
RESTFul风格的请求:
Url:localhost:XXXX/addUser/tom/18.action
SpringMVC对RESTFul风格的请求的处理:
/**
* RESTFul支持
*/
@RequestMapping("/hello10/{username}/{age}.action")
public String hello10(@PathVariable String username,@PathVariable int age,Model model) throws IOException{
System.out.println(username +"~"+age);
model.addAttribute("msg", "hello springMvc4,hello World4~");
return "hello";
}