struts2.xml中配置301跳转
301转向(或叫301重定向,301跳转)是当用户或搜索引擎向网站服务器发出浏览请求时,服务器返回的HTTP数据流中头信息(header)中的状态码的一种,表示本网页永久性转移到另一个地址。?
其它常见的状态码还包括,200表示一切正常,404网页找不到,302暂时转向,等等。?
?? 通常我们在jsp页面中通过response来实现,如:?toUrl = "http://xxx.com";
response.setStatus(301); response.setHeader("Location", toUrl); ??? 在struts2中我们可以直接通过配置来实现在action的result中配置以下内容即可
?<result name="to_first" type="httpheader"> <param name="status">301</param>
<param name="headers.Location">${youUrl}</param> </result>