You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Web Administrator <rs...@uswest.net> on 2000/03/23 04:23:05 UTC
newbie question on sessions in tomcat 3.0
Hi,
Thanks for the responses to my previous inquiry. I need a little more of
an education on sessions in Tomcat.
Sorry for the long post but I need a little education on how to get this
to work.
I have a html form that on submit, will call a servlet. The servlet
retrieves values from the form and stores them in a session object. The
servlet then generates html into the response stream which prints the
values stored in the session object and contains a link back to the
original form.
The problem I was having was that the next time I submit the form, the
session values from the previous submit were lost.
I tried the redirection to the original html page as suggested by Andrew
with the following code:
getServletConfig().getServletContext().getRequestDispatcher("/servlets/ShoppingCart.html").forward
( req, res )
I was unable to get the session values to persist even with this
method. Also the redirection worked only if nothing was written to the
response stream.
In this case I want to write to the response object because that's how I
print the contents of the shopping cart.
I am used to the concept of sessions being valid for as long as the
user is connected to the server. It appears that sessions in tomcat
don't work that way.
Could anyone give me some suggestions on how to make this work or some
alternative design.
Thank you very much for your help.
Rajiv.