Answers for "get url parameter in spring controller"

2

spring url parameter

@RequestMapping("/{someID}")
public @ResponseBody int getAttr(@PathVariable(value="someID") String id, 
                                 @RequestParam String someAttr) {
}
Posted by: Guest on October-19-2020
0

how to pass path parameter in url in spring rest

@RequestMapping(method = RequestMethod.GET, value = "/custom")
    public String controllerMethod(@RequestParam Map<String, String> customQuery) {

        System.out.println("customQuery = brand " + customQuery.containsKey("brand"));
        System.out.println("customQuery = limit " + customQuery.containsKey("limit"));
        System.out.println("customQuery = price " + customQuery.containsKey("price"));
        System.out.println("customQuery = other " + customQuery.containsKey("other"));
        System.out.println("customQuery = sort " + customQuery.containsKey("sort"));

        return customQuery.toString();
    }
Posted by: Guest on August-30-2020

Code answers related to "get url parameter in spring controller"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language