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

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlets and Sessions" Watch "Servlets and Sessions" New topic

Servlets and Sessions

B Wiley Snyder
Ranch Hand

Joined: Nov 26, 2003
Posts: 50
I have a servlet that saves a value to the session then redirects to a .jsp page. On the .jsp page I grab the value and display just fine. But when I hit the refresh button my value go's back to 0 ???

I thought If you saved something in the session it stayed there for the session and I'm not sure what I'm doing wrong, maybe somebody can give me a clue.

B Wiley Snyder
Ranch Hand

Joined: Nov 26, 2003
Posts: 50
Let me re-phrase what I'm doing.....

I'm not redirecting as in response.redirect I'm using this....

RequestDispatcher dispatcher =
W Ssssssss

Joined: Sep 01, 2004
Posts: 1
oops, I figured it out. It works great i was just setting the variable twice instead of setting then getting in the servlet. Thanks for all the replys !
It is sorta covered in the JavaRanch Style Guide.
subject: Servlets and Sessions