jsp http 301跳转

来源:互联网 发布:linux c 创建目录 编辑:程序博客网 时间:2024/05/16 23:33
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%String servername=request.getServerName();String serverPath=request.getServletPath();String addres="http://www.baidu.com";response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);response.setHeader("Location",addres);%>


访问这个页面直接跳转到baidu,作用当当前页面出现异常(比如获取移动相关鉴权码没得到时)可以直接重新跳转回当前页面或其他页面进行相关处理.

原创粉丝点击