Introduction:
URL rewriting technology appears because: some users he set their own browser cookie is disabled, so that the session will expire. Therefore, URL rewriting techniques appear.
principle:
is to add the Jessionid parameter to the hyperlink (which can be seen by looking at the source code) to achieve the function of the session.
The browser that disables cookies can also use session: Since the session is based on cookies, if cookies are disabled, the session is unavailable and we can rewrite all the URLs provided to the browser. Keep up with Jseesionid after all URLs to ensure that even if cookies are disabled, they can be brought back to jsessionid in the form of a URL, so that the session can be used. To rewrite all URLs is a very expensive job, and generally we will not do so.
Response. Encoderedirecturl (Java.lang.string?url) Use this method if this URL is the address of the redirect operation
Response. Encodeurl (Java.lang.string?url) Use this method if this URL is a normal connection
Example of the same previous implementation purchase. We just need to modify the JSP code.
<%@ page language= "java" import= "java.util.*" pageencoding= "UTF-8"%><span style= "Font-family:courier New;" ><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
Black Horse day05 URL rewrite