springmvc-restful风格

restful风格是一种设计风格,作用:伪静态化、方便搜索引擎的seo优化

请求路径:
<a href="${pageContext.request.contextPath }/student/sayHello/100.html">restful</a>

映射路径配置:

@Controller
@RequestMapping("/student")
public class Qi {
    @RequestMapping("/sayHello/{status}.html")
    public String sayHello(String name,@PathVariable("status")String status){
        System.out.println(name);
        System.out.println(status);
        return "forward:/WEB-INF/hello.jsp";
    }
}

  

猜你喜欢

转载自www.cnblogs.com/cdeelen/p/11019358.html