My code is :
@RequestMapping(value = "productDescription/{productId}/{competitorList}", method = RequestMethod.GET)
@ResponseBody
public ProductDescription getProductDescription(
@PathVariable String productId, @PathVariable String competitorList) {
return service.getProductDescription(productId, competitorList);
}
Using HttpServletRequest
request in postHandler method, I want to read the pathvariable names and values.
I am able to get parameter name and values using request.getParameterMap() method if I'm using @RequestParam instead @Pathvariable.
Try this:
@RequestMapping(value = "productDescription/{productId}/{competitorList}", method = RequestMethod.GET)
@ResponseBody
public ProductDescription getProductDescription(@PathVariable("productId") String productId, @PathVariable("competitorList") String competitorList) {
return service.getProductDescription(productId, competitorList);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.