在JSP里用
<%@page contentType="text/html;charset=utf-8"%>
<%
response.addHeader("Location", "http://www.host.com/");
%>或者,在JS里,也就是页面里,响应某个事件后调用
location.href = "http://www.host.com/";

解决方案 »

  1.   

    除了php中还有哪用header("location:url");
      

  2.   

    确实,只有PHP中能用header("location:url");,除非你自己定义一个~~
    这是修改HTTP头来实现页面转向的方式,无论什么样的服务器端脚本都支持,都能做,location.href = "";是通过脚本改变浏览器的URL,性质不同.
      

  3.   

    确实,只有PHP中能用header("location:url");,除非你自己定义一个~~
    这是修改HTTP头来实现页面转向的方式,无论什么样的服务器端脚本都支持,都能做,location.href = "";是通过脚本改变浏览器的URL,性质不同.
    ----------------
    怎么定义
      

  4.   

    我是说在别的语言里定义一个header函数,没别的什么意思,header方法就是直接修改HTTP头来实现转向的。