Home  >  Article  >  Web Front-end  >  页面转向_html/css_WEB-ITnose

页面转向_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:48:261013browse

第一种实现方法:
可实现转向include.jsp页面的功能
与Servlet中的页面转向等价:

RequestDispacher rd = request.getRequestDispacher("include.jsp");rd.forward(request, response);
第二种实现方法:
response.sendRedirect("include.jsp");
第二种实现方法:等价于:
response.setStatus(302);response.setHeader("location", "include.jsp");
二者的区别:
第一种:
可读取转向前的request对象;转向后的地址不发生变化,仍为原来的地址;不可转向本web项目以外的页面;向服务器发送一次请,速度相对较快
第二种:
不可读取转向前的request对象;转向后的地址发生变化,为所转向目标页面的地址;可转向本web项目以外的页面;向服务器发送2次请求速度相对较慢
 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn