How to map URL Query Strings of a request to model map of controller
A Search-web page has a link, when user clicks on that link. Request is dispatched and search parameters are sent in the form of query strings with the URL. I have to capture these query strings and display results in the same page(responding to the U开发者_高级运维RL with query strings) How to capture URL query strings and add them to modelmap of the controller, so that they can be passed to service class Can any one help me
thanks in advance. JV
This is how you should handle this /url.html?id=myId
@RequestMapping(value="/url", method=RequestMethod.GET)
@Responsebody
public ModelAndView handleMyExceptionOnRedirect(@RequestParameter("id") String id) {
ModelAndView mv = new ModelAndView("url");
mv.addObject("id",id);
return mv;
}
精彩评论