File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes REFRESH PROBLEM Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets


Hrvoje Canzek

Joined: Sep 18, 2002
Posts: 16
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.
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

Joined: Feb 28, 2002
Posts: 81
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

SCJP2 (93%),SCWCD(88%)<br />-------------------------------<br />Never under estimate yr self, just represent yr profile in proper manner.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
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.

"JavaRanch, where the deer and the Certified play" - David O'Meara
It's not a secret anymore!