标签:ret isp context throw index text send let ring
一、
@RequestMapping("/testVoid")
public String testVoid(HttpServletRequest request){
//转发方式一
return "forward:/WEB-INF/pages/success.jsp"; //转发到指定的页面并能获取megs值
//重定向方式一
return "redirect:testIndex"; 重定向到指定的Action,再跳转到相应的页面,获取不到megs值
}
二、
/**
*
*
*
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
@RequestMapping("/testVoid1")
public void testVoid1(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//转发方式二
request.getRequestDispatcher("/WEB-INF/pages/success.jsp").forward(request,response);
//重定向方式二
response.sendRedirect(request.getContextPath()+"/account/testIndex"); // 重定向到指定的Action,再跳转到相应的页面,获取不到megs值
return;
}
标签:ret isp context throw index text send let ring
原文地址:https://www.cnblogs.com/jock766/p/13290008.html