Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session tracking

 
Alan Shiers
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I have a strange problem you may be able to shed some light on. At least I hope so. I'm working with an existing project using JSP's and Servlets and a backend MySQL database. The project entails the ability to perform ad hoc queries to the database. The source code files can be found at the bottom of the page at:

http://www.eas.asu.edu/~cse494db/IonJDBC/JDBCExample.html

The project contains one servlet called Contol.java and a bean called QueryBean.java. The Control servlet is first invoked using a POST call. In doing so, a Session object is created and an instance of QueryBean is created and stored in the Session object. The QueryBean contains the meta data for the database. A jsp called QueryInput.jsp loads and at the same time also activates a second browser window loading MetaTables.jsp. When MetaTables.jsp loads in the second window it calls
QueryBean qb = (QueryBean)session.getAttribute("qBean");
from the session object retrieving the QueryBean instance and the meta data is used to be displayed in a table. The first time this process occurs everything is fine, until I dismiss the window containing MetaTables.jsp.

Here's what happens...QueryInput.jsp has a button on it. It is used to re-display the window that MetaTables.jsp loads into if the user dismisses that window when it first loads. Here's where the interesting part comes in. If I click on the button in the main browser window containing QueryInput.jsp the second browser window appears alright, but for whatever reason all the data that was in the QueryBean instance is gone. MetaTables.jsp loads and attempts to obtain the QueryBean instance again from the Session object, but there is no data to display. It's gone!

What's going on? Does anybody know?

Alan
 
Alan Shiers
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried posting some code, but your system refused to accept it for some reason. I kept getting an error page that recommended replacing all "<" symbols from my code, which I did. But that didn't help.
 
Tien-Chih Wang
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The session object in Control.java seems like a local object.
you can construct another HttpSession in your jsp page and print out all the Values by using getAttributeNames() to see what's going on.

Tien-Chih Wang
[ May 05, 2005: Message edited by: Tien-Chih Wang ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic