用户浏览器关闭cookie处理方法

方法一:

function getSessionId(){
   		var c_name = "jsessionid";
   	//	alert("cookie:"+document.cookie + "     " + window.location.href );
   		var hrefStr = window.location.href;
   		if(hrefStr.length > 0){
      		c_start = hrefStr.indexOf(c_name + "=")
      		if(c_start != -1){ 
       			c_start = c_start + c_name.length+1 ;
        		c_end = hrefStr.indexOf("?",c_start)
        		if(c_end == -1) 
        			c_end = hrefStr.length;
        	return  hrefStr.substring(c_start,c_end);
      		}
   		}
  	}
 

  方法二:

直接通过struts标签处理   请求中自动获取到jsessionid

1:

<form action=<s:url  action="user/login" />  method="post" id = "fromBut">
  <input type="hidden" name="user" value="" id="users">
</form>

  2:

<a href = 
  <s:url action="user/userlogin" > <s:param name="user.userId" value="%{user.userId}" />   </s:url>
>登录</a>

  

 

参考学习:http://justsee.iteye.com/blog/831730

posted @ 2015-06-19 17:46  a757956132  阅读(586)  评论(0编辑  收藏  举报