开发者

How to map URL Query Strings of a request to model map of controller

开发者 https://www.devze.com 2023-03-12 16:35 出处:网络
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 d

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;
  } 
0

精彩评论

暂无评论...
验证码 换一张
取 消