コード例:
<%@ page Language = "java" contentType = "text/html; charset = utf-8" pageencoding = "utf-8"%> <%// go to iq.jspout.clearbuffer(); response.setstatus(httpservletresresponse.sc_moved); request.getqueryString(); response.setheader( "location"、 "iq.jsp"+(param == null? ":("? "+param));%> <%@ page Language = "Java" contentType = "text/html; charset = utf-8" pageencoding = "utf-8"%> <%// go to iq.jsp out.clearbuffer(); Response.setStatus(httpservletResponse.sc_movedNelly); string param = request.getQueryString(); Response.setheader( "location"、 "iq.jsp"+(param == null? ":("? "+param));%>上記のように、download.jspへのすべてのアクセスにアクセスされ、iq.jspに永続的にリダイレクトされます
パラメーターも同時に持ち越されます。
リダイレクトがクロスドメインである場合、またはフルパスを使用している場合、使用できます
Response.setheader( "location"、 "http://www.laozizhu.com/iq.jsp"+(param == null? "" :( "?"+param));
Response.setheader( "location"、 "http://www.laozizhu.com/iq.jsp"+(param == null? "" :( "?"+param));
これにより、完全なターンオーバードメイン名を指定できます。
一般的な方法は、302ジャンプを達成することです。
Response.sendredirect(http://www.baidu.com);
Response.sendredirect( "http://www.baidu.com");