SpringMvc通过 return "redirect:/webpage/NewFile2.jsp"这种方式返回值时是通过重定向的方式返回的页面,此时客户端的url会改变。怎么带值呢?
可以使用 RedirectAttributes 的addFlashAttribute(key,value)方法 将值传到jsp页面,同时 需要在放置值的时候将session中的值remove(以便显示的时候是最新的值)。session.removeAttribute("org.springframework.web.servlet.support.SessionFlashMapManager.FLASH_MAPS");
在jsp目标页面通过el表达式取出:
${sessionScope['org.springframework.web.servlet.support.SessionFlashMapManager.FLASH_MAPS'][0][key]}
如果有更好的方法一定要告诉我!!