You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Adam Lipscombe <ad...@expensys.com> on 2005/04/11 18:56:24 UTC

Session object not the same in different JSP's

Folks,


I have an odd problem the manifests intermittently with TC 5.0.27 and Struts
1.1. I am not sure if it's a TC problem or Struts. I think its TC, but
apologies if this is not the correct forum.

The problem is this:

If validation errors are detected the app code stores them in the Struts
ActionError(s) object in the usual manner. The source JSP is then
re-displayed and a modal dialog box (another JSP) is popped (via calling a
Struts .do URL) to display the errors. 

The ActionErrors object is passed from the ,ain JSP to the modal dialog box
JSP by storing it in the session object. The dialog code then fishes out the
ActionErrors object and loops through the errors, displaying each one.

Most of the time this works fine. However occasionally the session object
that is used by the caller (i.e. the JSP) and the dialog are not the same
instance. i.e. The ActionErrors Object is stored in session X but the modal
dialog JSP uses session Y.


I was surprised by this to put it mildly. I thought the session had to be
the same.


If I restart TC having cleared out the work dir it all seem OK again.


Does anyone have any ideas? 


TIA - Adam




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Session object not the same in different JSP's

Posted by Adam Lipscombe <ad...@expensys.com>.
Thanks for that Wendy.


I thought it might be your suggestion about caching so I added code to the
JSP's to disable the browser cache.
I also added logging to display the session ID's and they are indeed
different:

>From the JSP that invokes the modal dialog: sessionID =
0E07F517D6AD7002500A46A6B37798F9
>From the modal dialog JSP itself: sessionID =
74D52752E99875A00132DE792311124B


This seems very odd. Does anyone have any ideas why they should be
different?
It only happens intermittently but once it starts to happen once has to shut
down TC to recover it.


TIA -Adam












-----Original Message-----
From: Wendy Smoak [mailto:java@wendysmoak.com] 
Sent: 11 April 2005 18:23
To: Tomcat Users List
Subject: Re: Session object not the same in different JSP's


From: "Adam Lipscombe" <ad...@expensys.com>
> Most of the time this works fine. However occasionally the session 
> object that is used by the caller (i.e. the JSP) and the dialog are 
> not the same instance. i.e. The ActionErrors Object is stored in 
> session X but the
modal
> dialog JSP uses session Y.

How do you know, are you printing out the session id?  If you're just going
by the fact that you're not getting the correct list of errors, could the
browser have cached the contents of the popup window?

-- 
Wendy Smoak


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Session object not the same in different JSP's

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Adam Lipscombe" <ad...@expensys.com>
> Most of the time this works fine. However occasionally the session object
> that is used by the caller (i.e. the JSP) and the dialog are not the same
> instance. i.e. The ActionErrors Object is stored in session X but the
modal
> dialog JSP uses session Y.

How do you know, are you printing out the session id?  If you're just going
by the fact that you're not getting the correct list of errors, could the
browser have cached the contents of the popup window?

-- 
Wendy Smoak


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Session object not the same in different JSP's

Posted by Dakota Jack <da...@gmail.com>.
Is there any chance that you are finding these results while running
two instances of the same browser on the same client machine?



On Apr 11, 2005 9:56 AM, Adam Lipscombe <ad...@expensys.com> wrote:
> Folks,
> 
> I have an odd problem the manifests intermittently with TC 5.0.27 and Struts
> 1.1. I am not sure if it's a TC problem or Struts. I think its TC, but
> apologies if this is not the correct forum.
> 
> The problem is this:
> 
> If validation errors are detected the app code stores them in the Struts
> ActionError(s) object in the usual manner. The source JSP is then
> re-displayed and a modal dialog box (another JSP) is popped (via calling a
> Struts .do URL) to display the errors.
> 
> The ActionErrors object is passed from the ,ain JSP to the modal dialog box
> JSP by storing it in the session object. The dialog code then fishes out the
> ActionErrors object and loops through the errors, displaying each one.
> 
> Most of the time this works fine. However occasionally the session object
> that is used by the caller (i.e. the JSP) and the dialog are not the same
> instance. i.e. The ActionErrors Object is stored in session X but the modal
> dialog JSP uses session Y.
> 
> I was surprised by this to put it mildly. I thought the session had to be
> the same.
> 
> If I restart TC having cleared out the work dir it all seem OK again.
> 
> Does anyone have any ideas?
> 
> TIA - Adam
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org