![[五]SpringMvc学习-Restful风格实现 [五]SpringMvc学习-Restful风格实现](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
1.Restful风格的资源URL
无后缀资源的访问(csdn用法)
2.SpringMvc对Rest风格的支持
2.1将 /*.do改为/
2.2
3.@PathVariable获取Url变量
@RequestMapping("/details/{id}")
public String list(@PathVariable("id") int id){
return "list";
}
4.SpringMvc对静态资源的处理
4.1配置文件中添加命名空间
4.2添加
<mvc:annotation-driven>
<mvc:resources mapping="/resources/**" location="/images"> 将resources映射到images文件夹中