JSP / Restart a session or create a new one

  • Thread starter Larry Yondespor
  • Start date
L

Larry Yondespor

Hi,
I work on a JSP project where my users send work
from a browser to legacy Unix scripts through a servlet.
When the work is completed, there is a Web page that appears
to on screen of the user for him to approve the results
of the work performed. If the user is not at his desk
the approval form stays on the user's monitor until and after
the session times out. When that happens the user cannot
use the form to approve the work. Is there a way to create
a new session on submit of a form if the session has timed out?
What would be the trick you would use?

Thanks

Larry
 
W

Wendy S

Larry Yondespor said:
Is there a way to create a new session on submit of a form if the session
has timed out?

What code are you using to get a reference to the session? There are two
signatures for 'getSession' (one that takes a boolean and one with no args).
Unless you're calling request.getSession( false ), a new session WILL be
created. My guess is that you're already getting a new session, the problem
is that since it's new, it's missing whatever you needed to be in there.
What would be the trick you would use?

First I would lengthen the session timeout for this webapp in web.xml. (I
think the default is 30 minutes.) Then I would attempt to educate the users
that they cannot just leave for hours and expect things to work when they
get back.

If that doesn't work, I would switch to a different model, one where job
submission is separate from approval. They would use one page to submit a
job, and a separate one to get a list of the things that need approval.
 
L

Larry Yondespor

Agree, switching to a different model is
probably the thing to do, since the users
like to send a job before they leave work at
5:00; to then approve the work done when they
come back to work on the next morning.

Thanks

===================================
 
R

Ryan Stewart

Larry Yondespor said:
Hi,
I work on a JSP project where my users send work
from a browser to legacy Unix scripts through a servlet.
When the work is completed, there is a Web page that appears
to on screen of the user for him to approve the results
of the work performed. If the user is not at his desk
the approval form stays on the user's monitor until and after
the session times out. When that happens the user cannot
use the form to approve the work. Is there a way to create
a new session on submit of a form if the session has timed out?
What would be the trick you would use?
You might look into the various Listeners in javax.servlet.http. Perhaps when a
session times out you could save the data and reload it when the user signs back
in.
 
M

Malte

If that doesn't work, I would switch to a different model, one where job
submission is separate from approval. They would use one page to submit a
job, and a separate one to get a list of the things that need approval.

I agree with the proposal to switch to a model more natural to the web.
Add a little authentication mechanism so you dont' have to rely on
sessions. Or simply use JavaMail to send them a message they can reply to.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,689
Members
48,796
Latest member
Greg L.

Latest Threads

Top