In my application I have to compare 3 products for that in my controller I mapped request as
@RequestMapping(value = "/products/{proId1}Vs{proId2}Vs{proId3}", method = RequestMethod.GET)
public ModelAndView compareThreeProducts(@PathVariable("proId1") int id1, @PathVariable("proId2") int id2, @PathVariable("proId3") int id3)
{
//someLogic
when hit my url(http://something/products/12Vs13Vs14)
I'm getting http 400 error
I also tried for 2 @pathVariable like
@RequestMapping(value = "/products/{proId1}Vs{proId2}", method = RequestMethod.GET)
public ModelAndView compareTwoProducts(@PathVariable("proId1") int id1, @PathVariable("proId2") int id2)
this is working fine but why i'm facing problem with 3 variables and also there are no errors in server log then how to find what's the bug.
any solution??
You could try lumping everything into one path variable then parsing it manually:
@RequestMapping(value = "/products/{compareIdString}", method = RequestMethod.GET)
public ModelAndView compareThreeProducts(@PathVariable("compareIdString") String compareIdString)
{
// split compareIdString on "Vs"
// parse each resulting value to an int
This is more of a workaround than a solution, though. You might want to debug in the Spring code as Bozho suggested if you want to try to figure out exactly what's going wrong.