Hi all.
I am building a swinf application that communicates with a servlet.
When I submit the username/password to a servlet, it authenticates user and loads another form, main menu.
If the user is valid, the login servlet sets the session like this:
HttpSession session = request.getSession(true);session.setAttribute("userValid", "yes");
When the main menu is loaded, it communicates with another servlet called menu.
this menu servlet checks whether the user has a valid session. I am doing this like this:
HttpSession session = request.getSession();String x = (String)session.getAttribute("userValid");if(x.equals("yes"){//execute codes}
Is this method correct?...how do I check whether the user has already logged in.
Thanks a lot.