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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session problem" Watch "Session problem" New topic

Session problem

Deepak Tewari

Joined: Aug 04, 2005
Posts: 10
I am facing some unusual problem,
Problem is, I have one JSP page and one servlet,
JSP page opens as a model window.
I have one loged in user, when the user clicks on the
href link on the jsp which is model window to go to the
servlet, but the user gets logeout of the site, means session is
not getting maintained in the path.
Abnormality with this problem is,It is specific to the browsers,
for some browsers session is getting maintained and not for others.

Solution I tried:-
append jsession id with the URL,
used encodeURL also, but problem persists.

Point to note:-
As for the cases it is working fine, the session id
I append with the url is the same what I get on servlet
while debugging,
But it differs with the cases when we have problem.

Thanks in advance if any one can help me.

Deepak Tewari
Debajyoti Sinha

Joined: Sep 14, 2007
Posts: 1
Can you tell us in which browser session is maintained in which browser not ?

I know in IE , the session is maintained by using cookies by default, unless they are disabled by the client browser.

You had mentioned that you also used URL rewriting..but it is sometimes browser dependent.

By default the Web Container sends or receive session ID using cookie.

You may want to do something like this to see if your cookies are set in the request header.See the atached code. Include the following code in your program and see if the cookie is set.

pw.println("SessionID =" + mysession.getId() + "<br>");
pw.println("<h3>Following are the headers that server received.</h3><p>");
Enumeration headers = req.getHeaderNames();
while (headers.hasMoreElements() )
String header = (String) headers.nextElement();
String value = req.getHeader(header);
pw.println(header + " value= " + value + "<br>");
hope this helps...
Deepak Tewari

Joined: Aug 04, 2005
Posts: 10
This problem is comming with the IE itself, exactly I too not able to figure out the problem, I have checked the session id for one version it same on jsp and servlet and for the other where the session is not maintined it differs.
This problem is with different versions of ie.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Did you verify that session cookies (MSIE treats them differently than other cookies) are enabled?

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Session problem
It's not a secret anymore!