GeeCON Prague 2014*
The moose likes Servlets and the fly likes HttpSession failure--Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpSession failure--Help" Watch "HttpSession failure--Help" New topic
Author

HttpSession failure--Help

N SRao
Greenhorn

Joined: Nov 13, 2001
Posts: 11
Hi
I am geting problem with the session in servlet.I am using the jswdk 1.0.1 as webserver. I am chaining 4 servlets one by one and passing the session variable from one servlet to other servlet. But when I tried to access the session variable from the next servlets, getting the session variable as null.

I am using the session objects as follows in all the 4 servlets.
No where I used session invalidate or timeout methods.
HttpSession httpSession = req.getSession(true);
session.getValue(arg);
session.putValue(arg);
thanks
srao
deepak bansal
Ranch Hand

Joined: Feb 25, 2001
Posts: 33
Hi,
Are you forwarding the request from one servlet to another within the server OR you r first going to the browser then next servlet then browser and so on....If second is your case then U try encodeURL before submitting to the jsp. If first is you case then send some lines of your code.
my mail id is ..deepak_gupta@infy.com
Deepak
------------------
Be Truthful to yourself!


Be Truthful to yourself!
Sandeep Jain
Ranch Hand

Joined: Oct 25, 2000
Posts: 124
Hi,
U can use encodeURL of HttpServletRequest class .What this meyhod does is it attaches the current session id to the url and then sends it to the server.
So the session will not get invalidate when the data is send from one servlet to the other servlet.

------------------
Try and Try Till u succeed
Sandeep Jain


Try and Try Till u succeed<br /> <br />Sandeep Jain
N SRao
Greenhorn

Joined: Nov 13, 2001
Posts: 11
Dear Sandeep, I tried using this URLencode, but my problem was not solved, please give alternate solution
thanks
Hari
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HttpSession failure--Help