如果cookie被禁用了,而且我们又无法控制让用户启用,那么我们可以用
 
  1. HttpServletResponse response = ... // 这个默认在JSP里面是有的,无需获得     
  2. response.encodeURL("http://www.laozizhu.com");     
  3. response.encodeRedirectURL("http://www.laozizhu.com");    
HttpServletResponse response = ... // 这个默认在JSP里面是有的,无需获得 response.encodeURL("http://www.laozizhu.com"); response.encodeRedirectURL("http://www.laozizhu.com");
 
这样,你就会发现你的url后面多了一个小尾巴
/grid.jsp;JSESSIONID=fjsdklafjdsfsldkafjlsf?type=1
其中的分号和JSESSIONID就是自动加上去的东西了