public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
test3(request, response);
}
private void test3(HttpServletRequest request, HttpServletResponse response)throws IOException,ServletException
{
String message = "<meta http-equiv='Refresh' content='3;url=/ResponseDemo5/2.jsp'> 恭喜你,登陆成功,本浏览器将在3秒后跳转到登陆页面,如果没有跳转,请点击<a href=''>超链接</a>";
this.getServletContext().setAttribute("message", message);
this.getServletContext().getRequestDispatcher("/MyJsp.jsp");
}
<body>
<%
String message = (String)application.getAttribute("message");
out.write(message);
%>
</body>
<body>
<hr>恭喜你跳转到登陆页面<hr>
</body>