HttpServletRequest.getSession特性和Session週期

request.getSession()和HttpServletRequest.getSession(boolean)的區別Session的生命週期瀏覽器

 

HttpSession session=request.getSession();session

1查詢瀏覽器中是否有session對象,對象

2若是沒有,就建立一個新的session對象生命週期

3若是有,就取出session對象get

 

HttpSession session=HttpServletRequest.getSession(boolean);io

當boolean爲true時,和request.getSession()同樣request

當boolen爲false時,只查詢,沒有查到,返回nullim

 

 

HttpSession 的生命週期:查詢

 

相關文章
相關標籤/搜索