I’m creating a simple Java webapp using Tomcat 7. In this site only logged users can view the content, so I have a main page index.jsp which contains only 2 forms, one to log-in and other to sing-up. Only once the user has logged-in or registered, he can access the website content.
I’d like to avoid users to enter username and password each time, so I think I could use cookies to achieve this, right?
If it’s right, I’d like to know how to do it… my first approach is to use a servlet, and use the url of this servlet as the entry point of my webapp, but I’m not sure that this is the best practice at all…
And anyway, if finally it is a good practice, can I set this url as the default entry point or something like that?
I would use a filter. The filter can check for the cookie and handle the authorization pieces in it.
Googling “jsp remember me” would get you more ideas: