Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Management

 
Frank Truong
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a question about session object utilized in Struts.

In my SignOnAction, I keep a copy of java.sql.Connection object in the session, so I can re-use it later. This works well locally (Tomcat inside netbeans). However, it always returns null on this Connection object when I run the project outside of IDE(external Tomcat). I am sure I am using the same session object(session.isNew() returns false). I could even 'see' this Connection object in my jsp page, but when entering subsequent action, the same session(I think because session.isNew() returns false) no longer carries that Connection object.

Did my jsp just create another session for me???

What would be your suggestion where I should look into?

Thank you.
Frank
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

Session will not depend on your IDE.. and you jst will not create automatically session for you...

Just check have you use same name variable as your session variable name some where else or debug your application on that request.....

 
Frank Truong
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have realized that my session has lost between actions.

I have tested my program on multiple computers; the program works for all machines except on one computer in which I always got a new session in subsequent action even though I tried not to create new one by using request.getSession(false) method in this action. Apparently, a new session has already been created before this method call. Right before the execution gets to my action, I double-checked my session id (in my jsp) and my session was still there. The only place the execution has gone through before executing my action is the actionform which should not have anything to do with session creation, I believe.

This issue is occurring on ONLY ONE machine. I turned to cookies settings on the browser since some blogs have offered that if browser disables cookies acceptance, the session will be lost between actions. I made this browser more generous on cookies acceptance but problem still persisted.

I am stuck.

Frank
 
Dpk arora
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frank,
Even I am facing the same issue. did you gt the solution of this problem?

Thanks,
Dpak
 
Frank Truong
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmmh, It has been awhile. I didn't document how I could get by this issue!

I have made quite a number of changes in order to get by this issue. Among those changes, in javascript code, was to have replaced XMLHttpRequest with ActiveXObject('Microsoft.XMLHTTP') - my app supports only IE!

Not too helpful, is it?

Good luck.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic