This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Session Tracking in Websphere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session Tracking in Websphere" Watch "Session Tracking in Websphere" New topic
Author

Session Tracking in Websphere

Sat Ram
Greenhorn

Joined: Dec 31, 2002
Posts: 5
I am calling a JSP from a Servlet. In the Servlet I am puting an object in session. In the JSP i am getting the same session. This JSP is a frame set and calls two other JSP's. The JSP's that are called in this frame set does not have the same session ID. How do I carry the same session ID from the frame set JSP to the other two jsp. I am running this application in Websphere.
I tried using response.encodeURL but still does not work. Can any one suggest what is the problem.
Code in Frame set JSP :
<%@ page session="true" %>
<%@ page language="java" %>
<%@ page errorPage="errorPage.jsp"%>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page buffer="2080kb" autoFlush="true" %>
<%@ page import="com.jbh.apps.filenet.pod.*"%>
<%PodUserBean userBean = (PodUserBean) session.getAttribute(PodConstants.USERBEAN);
%>

<HTML>
<HEAD><TITLE></TITLE></HEAD>
<frameset frameborder="0" framespacing="0" border="0" cols="*" rows="60,*" >
<frame marginwidth="0" marginheight="0" src="<%=response.encodeURL("pod/header.jsp")%>" name="headerFrame" noresize scrolling="no">
<frame marginwidth="0" marginheight="0" src="<%=response.encodeURL("pod/podSearchCriteria.jsp")%>" name="contentFrame" noresize scrolling="auto">
</frameset>
</HTML>
Steve Granton
Ranch Hand

Joined: Jan 13, 2002
Posts: 200
Hi,
To the best of my knowledge the problem is not with Websphere session management. The problem you are experiencing is probably due to the way framesets work. This occurs because the browser fires two requests (one request per frame) to the Webserver - the webserver forwards these requests to websphere. Because the browser hasn't passed the session information to these requests websphere creates two new sessions.
If you think about what you are asking you are effectively saying "I want multiple frames to access the same session", which would open the problem of multi-threading on the session instance.
I'm sure that this isn't what you have in mind so you probably want to look at re-designing the solution - rather than frames use why not construct the page by using jsp directive

I hope this helps,
Steve
Sat Ram
Greenhorn

Joined: Dec 31, 2002
Posts: 5
Hi Steve
This Code works fine in Weblogic.
Sat Ram
Greenhorn

Joined: Dec 31, 2002
Posts: 5
Can anyone tell me how to make it work in websphere.
Ruchi Kolla
Greenhorn

Joined: Jan 24, 2002
Posts: 19
How do you transfer call to JSP from servlet? Is it a redirect or forward? Is there any special webserver exists infront of Websphere?
Sat Ram
Greenhorn

Joined: Dec 31, 2002
Posts: 5
I use this code to transfer from Servlet to JSP. In the JSP which has a frame set I get the same session from the servlet. But when I call two other JSP's in the frame set.I loose the session in the called two JSP's.I am using websphere 3.5.4 and there is no other webserver in front of this.
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(response.encodeURL("/pod/podHome.jsp"));
if (dispatcher != null) {
dispatcher.forward(request, response);
}
Steve Granton
Ranch Hand

Joined: Jan 13, 2002
Posts: 200
Hi,
In that case - have you checked the Session Manager Service settings on Websphere - are you using cookies for session management rather than url encoding? Maybe this is your problem.
Cheers,
Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Tracking in Websphere
 
Similar Threads
stuts with frames
xsl: html: getting attribute from other frame with refresh: Update info
getting information (xml attribute) in frame with HTML code from other frame
hide absolute path on the url
Jboss 5.1.0 jsp:root not working