[五]SpringMvc学习-Restful风格实现

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文件夹中

原文地址:https://www.cnblogs.com/luoxiaolei/p/5125850.html