servlet怎么跳转到jsp
1个回答
展开全部
servlet使用RequestDispatcher到jsp页面
String url="/EShop.jsp";
ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher(url);
rd.forward(req, res);
servlet重定向jsp,并将数据发送到别一个JSP中:
request.setAttubute("messages",aaa);
RequestDispatcher requestDispatcher=request.getRequestDispatcher("/jsp/testbean.jsp");
requestDispatcher.forward(request,response);
String url="/EShop.jsp";
ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher(url);
rd.forward(req, res);
servlet重定向jsp,并将数据发送到别一个JSP中:
request.setAttubute("messages",aaa);
RequestDispatcher requestDispatcher=request.getRequestDispatcher("/jsp/testbean.jsp");
requestDispatcher.forward(request,response);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询