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

时间:2015-11-18 10:13:06

标签: java jsp spring-mvc

@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返回serchResult.jsp但我想保持serch结果在当前的jsp(search.jsp)中如何实现这个

view Search.jsp

1 个答案:

答案 0 :(得分:1)

  

Curently Searchresults返回serchResult.jsp但我希望将serch结果保存在当前的jsp(search.jsp)中如何实现此目的

这是因为您在方法中返回serchResult.jsp。只需将返回的ModelAndView更改为search

即可
return new ModelAndView("search", model);