简体   繁体   中英

How to return list reults to current jsp in spring MVC by controller

@RequestMapping(value="/doSearch", method = RequestMethod.POST)
public ModelAndView listSerchClients(@RequestParam("bnCustomerName") String searchText) {
    Map<String, Object> model = new HashMap<String, Object>();
    model.put("sclients",  prepareListofBean(clientService.listSearchClientss(searchText))) ;            
    return new ModelAndView("serchResult", model);
}

Curently Searchresults return to serchResult.jsp but i want to keep serch result in current jsp (search.jsp) how to achieve this

view Search.jsp

Curently Searchresults return to serchResult.jsp but i want to keep serch result in current jsp ( search.jsp ) how to achieve this

This is because you return serchResult.jsp in the method. Just change the returning ModelAndView to search

return new ModelAndView("search", model);

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM