Prevent showing Login screen after user login
Web Apllication shows login screen after logged in when i click back button in bro开发者_StackOverflowwser.
I am using spring framework. Is there any Solution for this?
Use sessions. If he has logged in, save his username, or id to a session variable. At your login page, make sure to check that session. If it exists, redirect him to another page. Else, login.
I don't recommend using self-implemented authentication tools unless there is a strong reason not to use existing libraries (very rare case, based on my experience).You might want to check out spring-security, a project which could deliver pretty much everything you might need in terms of securing your web application. You definitely can achieve this behavior using this library. Although, it didn't work properly in Mozilla Firefox, if I recall. I guess Mozilla just reads the webapp from cache and doesn't even communicate to the server in such cases. But I might be wrong here.
精彩评论