您的位置:首页 > Web前端 > JavaScript

Jsp如何实现网页的重定向

2006-09-11 19:45 323 查看
1.可以使用:

  response.sendRedirect(”http://www.foo.com/path/error.html”);  

  2.可以手工修改HTTP header的Location属性,如下:

<%
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
String newLocn = “/newpath/index.html”;
response.setHeader(”Location”,newLocn);
%>  

  3.也可以使用forward:

  <jsp:forward page=”/newpage.jsp” />  

  请注意:只能在任何输出还没有发送到客户端之前使用这种方式。

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  jsp header string