Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlets and Sessions" Watch "Servlets and Sessions" New topic
Author

Servlets and Sessions

B Wiley Snyder
Ranch Hand

Joined: Nov 26, 2003
Posts: 50
Hello,
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.

-thanks
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 =
getServletContext().getRequestDispatcher("/test.jsp");
dispatcher.forward(request,response);
W Ssssssss
Greenhorn

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 !
 
Consider Paul's rocket mass heater.
 
subject: Servlets and Sessions