2012-01-24 45 views
-2

可能重複:
not able to solve java session沒有能夠解決Java會話請求再次登錄

HttpSession sess = request.getSession();  
    String username=request.getParameter("firstname"); 
    String password=request.getParameter("pwd"); 
    boolean flag; 
    if(username!=null && password!=null){ 
     flag=checking.check(username, password); //here i check if user exists in //the data base 
    }else{ 
    flag=false; 
    } 
    if(flag){ 
    put2.sessionAttr(username,password,sess); // here i call a java class through bean put2 and set attributes to the session 
    response.sendRedirect("index.jsp"); 
    } 
在我將屬性添加到會話結束

我設置的用戶名的屬性..

在關閉瀏覽器而不註銷之後,我輸入相同的URL並調用以下j SP通過Ajax

但會議似乎沒有屬性的所有.. 所以我必須輸入用戶名和密碼再次..

+0

你爲什麼再問這個問題? –

回答

0

關閉瀏覽器意味着你失去了會話。打開一個新的瀏覽器總是會創建一個新的會話,因此你會看到這種行爲。

0

當您關閉瀏覽器時,會話將自動清除,您不能再訪問該會話。

相關問題