This discussion is archived
5 Replies Latest reply: Mar 24, 2011 1:34 AM by gimbal2 RSS

Issue with multiple HttpSession created in multi-frame web page

849154 Newbie
Currently Being Moderated
Hi,

Recently I have run into a strange problem. I created a simple web page ( main.jsp) that contains a frameset with two frames: bannerFrame.jsp and mainFrame.jsp. I also have a servlet filter that applies to all pages and will create a user profile into the HttpSession object if it has not been created. I expect a single session to be created throughout the whole user session so that both bannerFrame and mainFrame share the same HttpSession object.

However I have noticed that three HttpSession objects are created inside the WAS 7 server, one for main.jsp hit, one for bannerFrame.jsp and the third for mainFrame.jsp. My HTTP sniffer shows that the JSESSIONID was sent to the browser when the content of main.jsp was sent back to the browser and the same JSESSIONID was indeed sent to the server when bannerFrame.jsp and mainFrame.jsp requests hit the server. But WAS still created new sessions for bannerFrame and mainFrame.

This is very strange. I've also tried to follow IBM's suggestion (http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/cprs_best_practice.html). I made both main.jsp and bannerFrame.jsp session free. Only when mainFrame.jsp hits the server, a session is created. It was awkward but I gave it a try any way. Well another issue came up. When I hit a link inside the mainFrame.jsp, WAS apparently didn't recognize a session has created therefore causes a lot of problem for the new page.

In short, it seems to me that multiframe design simply didn't work at all with HttpSession. This is bad since I thought putting my banner into a frame seems to be a very elegant design.

Before I give up on the multiframe based design idea, I'm wondering whether anybody has run into the same issue. If you have, could you please share how you did it if you have resolved the issue?

Thanks for any help!

-Anqing

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points