• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

REFRESH PROBLEM

 
Hrvoje Canzek
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi together,
my problem is as follows
i have a login.jsp (username,password) when i entered this information and click on submit the form sends that data to my FrontServlet(part of my FrontController).This FrontServlet forward this information to my LoginHandler (normal class)wich checks the username and password. When it is ok, my LoginHandler creates a new session and sets (setAttribute()) a loginOK into the session.
then the Loginhandler starts my ServiceDispatcher who display the requested site to the user.
EVERYTHING WORKS FINE.
BUT, when the session is timed out, and i click on the refresh button the browser sends the login information (username,password) again to my FrontServlet wich repeats the login-procedure and displays the site again, with a new created session. That is not what i want. I want that when the session is timed out a relog-page(simple html page) should be displayed("Session is timed out, please relog!!").
Does anybody know what my problem is??
thank you in advance
Hrvoje Canzek (HOWY)
 
Dharmin Desai
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Hrvoje Canzek,
When u refresh yr page at browser is same as that u enter yr username and password again and create another session.
But a solution for yr problem may be this:
Set one variable in yr session (say login name). Then, write one class who extends SessionBindingEvent Listener. In this class override valueUnbound() method.
So, what happens now is, When yr session will timeout Container will call method valueUnbound() on this class.
Now, In this valueUnbound() method, redirect / forward the request to yr login page.
Hope this helps,
Best regards, Dharmin
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dharmin,
Please change your name to be compliant with JavaRanch's naming policy.
Your displayed name should be 2 separate names with more than 1 letter each. We really would prefer that you use your REAL name.
You can change your name: here.
Thanks,
Cindy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic