简体   繁体   中英

Check whether the user is already logged in or not

I am currently working on a web application developed on Servlet-JSP MVC which runs on a internal server and the problem scenario is as below.

If the end user enter the site url,the application will ask for login credentials and i am checking the credentials in a LoginController.

Consider the situation when the user enter the credentials and login into the application and then closes the browser window,if the user again types the url it will again ask for the login credentials.

Now i want my application to remember whether a user is logged in or not,only ask for the login credentials if the user is already not logged in.

How can i implement this?Any suggestions on what can be done will be helpful.

Thanks in advance,

The browser has to store the information if the user is logged in. You could use cookies for that.

You can simply store a value that says: No need to check for password. Or you can store the username in the cookie and send it to the server which checks if the user is logged in and then replies the result to the browser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM