aspose file tools*
The moose likes Servlets and the fly likes Strange Session Attribute Behavior Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Strange Session Attribute Behavior" Watch "Strange Session Attribute Behavior" New topic
Author

Strange Session Attribute Behavior

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1466
    
    1
I call a servlet and set a session attributes, it then calls a jsp(menu page), next I click a menu item to call a servlet which uses the afore mentioned attributes but it acts like they don't exist, well sometimes.

We have a local intranet which contains a company page containing links to my web apps. The above happens when a remote part of our company tries to use the app accross a t1 line. However, if the same users directly type in the address to the site it works fine.
[ January 18, 2008: Message edited by: Steve Dyke ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

This is a bit vague
it then calls a jsp(menu page)

since servlets don't 'call' JSPs.
They can forward to them or issue sendRedirect command to get the browser to make a new request for the JSP.

In any case since you're talking about session scope either should work.
In your subnet, are the machines always using the exact same address to locate the machine or are some using an IP, while others use a machine name via WINS or some other naming service?

If the same site is accessed by the same browser but with a different domain or IP, the requests will generate separate sessions.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1466
    
    1
In our main building we have our servers including the iSeries server which hosts the Web Apps. We also have a building where the users there connect through a TI line. Everyone can access our intranet site. From here there are fully qualified links to the web apps index.jsp page. This index.jsp has a link to a main servlet where session attributes are set. This servlet, after preforming its functions which includes the RequestDispatcher which opens a mainmenu.jsp page. This jsp has links on it used to make requests to another servlet to display data. This servlet depends on session attributes set in first servlet.

Now everyone in main building has no problems.
Anyone remote has no problems if they access the Webapp from a web browser using fully qualified URL.
But remote users use the intranet links can access the web app, the index.jsp works, the first servlet works(I have verified the session attributes are set with proper values), the mainmenu.jsp will display ok but links from this point will fail because servlets requested from here that use the session attributes set before see them as null.

It seems like a session starts then it starts another session.
 
wood burning stoves
 
subject: Strange Session Attribute Behavior