如何从一个servlet重定向到另一个两个jsp文件
try {
HttpSession session =request.getSession();
session.setAttribute("phonevalues", modal);
response.sendRedirect("newdis.jsp");
response.sendRedirect("discondis.jsp");
response.sendRedirect("redisp.jsp");
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
答案 0 :(得分:0)
您需要更改页面设计。创建包含一个或多个视图/ JSP的Web页面。您可以使用<jsp:include />
操作或<%@ include %>
指令:
pageTest.jsp
<jsp:include page="newdis.jsp"/>
<jsp:include page="discondis.jsp"/>
<jsp:include page="redisp.jsp"/>
并重定向pageTest.jsp,
HttpSession session =request.getSession();
session.setAttribute("phonevalues", modal);
response.sendRedirect("pageTest.jsp");