坑爺了T斐伞显熏!
request.getSession().getId()將返回服務(wù)器的會話ID(如果會話不存在,request.getSession()將創(chuàng)建它)晒屎。
request.getRequestedSessionId()是從cookie中獲取的~~ 喘蟆,如果瀏覽器沒有cookie,或者客戶端沒有指定cookie鼓鲁,它就是空的蕴轨。
真的太不靠譜了~~
mmp
getRequestedSessionId:沒有指定,則為null~~
/**
* Returns the session ID specified by the client. This may not be the same
* as the ID of the current valid session for this request. If the client
* did not specify a session ID, this method returns <code>null</code>.
*
* @return a <code>String</code> specifying the session ID, or
* <code>null</code> if the request did not specify a session ID
* @see #isRequestedSessionIdValid
*/
public String getRequestedSessionId();
getSession:沒有Session則創(chuàng)建
/**
* Returns the current session associated with this request, or if the
* request does not have a session, creates one.
*
* @return the <code>HttpSession</code> associated with this request
* @see #getSession(boolean)
*/
public HttpSession getSession();