티스토리 뷰

공부

[spring] @PathVariable List<Integer> ids

승가비 2023. 9. 19. 23:58
728x90
@RequestMapping(value="/test/{firstNameIds}", method=RequestMethod.GET)
@ResponseBody
public String test(@PathVariable List<Integer> firstNameIds) {
     //Example: pring your params
     for(Integer param : firstNameIds) {
        System.out.println("id: " + param);
     }
     return "Dummy";
}

https://stackoverflow.com/questions/9623258/passing-an-array-or-list-to-pathvariable-spring-java

 

Passing an Array or List to @Pathvariable - Spring/Java

I am doing a simple 'get' in JBoss/Spring. I want the client to pass me an array of integers in the url. How do I set that up on the server? And show should the client send the message? This is w...

stackoverflow.com

 

728x90
댓글