<%-- Document : doRedirect Created on : 2020-4-12, 8:04:22 Author : Administrator --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <% // 生成页面响应 out.println("===="); // 重定向到redirect-result.jsp页面 response.sendRedirect("redirect-result.jsp"); %> </body> </html>
<%-- Document : redirect-result Created on : 2020-4-12, 8:05:36 Author : Administrator --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title> redirect目标页 </title> </head> <body> <h3>被重定向的目标页</h3> name请求参数的值:<%=request.getParameter("name")%> </body> </body> </html>