怎么把request.getRequestDispatcher("MyJsp.jsp")forward(request, response)换成response.sendRedirect
sevrlet里的语句publicvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)thr...
sevrlet里的语句
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String aa="abccc";
request.setAttribute("a",aa);
request.getRequestDispatcher("MyJsp.jsp").forward(request, response);
}
Jsp页面的语句
${requestScope.a}
问题是怎么把 request.getRequestDispatcher("MyJsp.jsp").forward(request, response)换成;response.sendRedirect("MyJsp.jsp");还能在JSP页面接收数据 展开
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String aa="abccc";
request.setAttribute("a",aa);
request.getRequestDispatcher("MyJsp.jsp").forward(request, response);
}
Jsp页面的语句
${requestScope.a}
问题是怎么把 request.getRequestDispatcher("MyJsp.jsp").forward(request, response)换成;response.sendRedirect("MyJsp.jsp");还能在JSP页面接收数据 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询