Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in reading requestMapping in spring mvc 3.0

 
hem kumar
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to handle a URL which comes from the client side like this: $.ajax({url : "someString/"+ catID+"/"+productName+"/"+imageSrc,
in that above url the imageSrc contains multiple forward slashes("/").
now my controller class method for handling this looks like this:

@RequestMapping(value = "/someString/{categoryId}/{productId}/{imgSrc}", method = RequestMethod.GET)
public void someMethod(Model model,
@PathVariable("categoryId") String categoryId, @PathVariable("productId") String productId,
@PathVariable("imgSrc") String imgSrc, HttpServletRequest request)

but its not giving the correct url. The middle {productId} is always getting erased and replaced by the {imgSrc}.

is there anyway to get this working, i.e, is there anyway to handle this type of variable length string using spring mvc 3.0?
thank you.
 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please add code tags and post your complete code? Looks like your syntax is incorrect
 
hem kumar
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks vyas. Actually the problem was somewhere else. The imageSrc contained a "../" at the begining and it was creating problems. The syntax code i produced here is working correctly. Now seems the problem is resolved.Thank you once again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic