This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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 !
 
Don't get me started about those stupid light bulbs.
 
subject: Servlets and Sessions
 
Similar Threads
Reflect the new value of a session variable updated via AJAX.
session values
returning value from jQuery
Help Needed -- how do I store and retrieve a session variable?
JSP session issue