springmvc-restful style

restful style is a design style, role: the pseudo-static and convenient search engine optimization seo

Request path:
<a href="${pageContext.request.contextPath }/student/sayHello/100.html"> RESTful </a>

Map the path configuration:

@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";
    }
}

 

 

  

Guess you like

Origin www.cnblogs.com/cdeelen/p/11019358.html