使用JSP大约有下列三种跳转方式: 1. response.sendRedirect(); 2. response.setHeader("Location",""); 3. <jsp:forward page="" /> 经过试验得到下面的一些规则: 一. response.sendRedirect() 此语句前不允许有out.flush(),如果有,会有异常: java.lang.IllegalStateException: Can't sendRedirect() after data has committed to the client. at com.caucho.server.connection.AbstractHttpResponse.sendRedirect(AbstractHttpResponse.java:558) ... 跳转后浏览器地址栏变化...
使用JSP大约有下列三种跳转方式: 1. response.sendRedirect(); 2. response.setHeader("Location",""); 3. <jsp:forward page="" /> 经过试验得到下面的一些规则: 一. response.sendRedirect() 此语句前不允许有out.flush(),如果有,会有异常: java.lang.IllegalStateException: Can't sendRedirect() after data has committed to the client. at com.caucho.server.connection.AbstractHttpResponse.sendRedirect(AbstractHttpResponse.java:558) ... 跳转后浏览器地址栏变化 如果要跳到不同主机下,跳...