SpringMVC RequestMapping for GET parameters

前端 未结 6 2009
执念已碎
执念已碎 2020-12-07 12:21

How to make the RequestMapping to handle GET parameters in the url? For example i have this url

http://localhost:8080/userGrid?_search=false&nd=135197257         


        
6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-07 12:58

    If you are willing to change your uri, you could also use PathVariable.

    @RequestMapping(value="/mapping/foo/{foo}/{bar}", method=RequestMethod.GET)
    public String process(@PathVariable String foo,@PathVariable String bar) {
        //Perform logic with foo and bar
    }
    

    NB: The first foo is part of the path, the second one is the PathVariable

提交回复
热议问题