简体   繁体   English

如何通过控制器将列表返回结果返回到Spring MVC中的当前JSP

[英]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 当前,Searchresults返回到serchResult.jsp但我想将serchResult.jsp结果保留在当前的jsp(search.jsp)中,如何实现此目的

view Search.jsp 查看Search.jsp

Curently Searchresults return to serchResult.jsp but i want to keep serch result in current jsp ( search.jsp ) how to achieve this 目前,Searchresults返回到serchResult.jsp但是我想将serch结果保留在当前的jsp( search.jsp )中,如何实现这一点。

This is because you return serchResult.jsp in the method. 这是因为您在方法中返回了serchResult.jsp Just change the returning ModelAndView to search 只需更改返回的ModelAndView进行search

return new ModelAndView("search", model);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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