首页 技术教程 实用代码 注册破解 正则表达式 网址导航 电子书籍

JSP三种页面跳转方式的比较

使用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技术    查看:91    更新:2014-06-27

JSP三种页面跳转方式的比较

使用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技术    查看:102    更新:2014-05-20