SpringMVC注解@RequestMapping全面解析

@RequestMapping 可以出现在类级别上,也可以出现在方法上。如果出现在类级别上,那请求的 url 为 类级别上的@RequestMapping + 方法级别上的 @RequestMapping,否则直接取方法级上的 @RequestMapping。 类级别的@RequestMapping 不是必需的。 

http://zachary-guo.iteye.com/blog/1318597

1

@PathVariable可以携带多个参数

 

@RequestMapping("/publication/{publicationType}/{specifyPublisherId}/{specifyPublisherType}/{isPar}")
    public void queryPublicationList(@PathVariable String publicationType, @PathVariable String specifyPublisherId,
            @PathVariable String specifyPublisherType,@PathVariable Boolean isPar, HttpServletRequest request, HttpServletResponse response) {

2

    @RequestMapping(value="/revocation",method=RequestMethod.POST)
    @ResponseBody
    public Object revocation(@RequestParam(required=true)String publicationType,
            @RequestParam(required=true)Long id,
            @RequestParam(required=true)Byte codeType,
            @RequestParam(required=true)String revDesc,HttpServletRequest request){

 

3

 

posted @ 2016-05-18 19:00  YOU_CAN  阅读(292)  评论(0编辑  收藏  举报