You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Yaman Kumar <ya...@nous.soft.net> on 2002/06/02 13:55:37 UTC

Help needed on new child window is treated in new session by JavaScript from parent window

Hi,
I'm not sure to say this is bug in Tomcat4.x,
 but I'm facing it with Tomcat4.x(all versions above  4).

My application is loaded in a parent window there user logs into application
and
in servlet I validate the user login info and keep so much information in
session
( say id is x)and a new page is supplied by server and loaded in the parent
window
and parent window opens another window(child) using JavaScript
that will hide all browser controls in child window (please look at the code
that is
in page loaded in parent window).

function show(){
	childWindow1=window.open("myapp/userinfo.jsp?name=<%
=userName%>","child1","HEIGHT="+hit+",WIDTH="+wid+",top=0,left=
0,status=YES,scrollbars=YES");
}

Problem: The child window that is opened from parent is not "ALWAYS"
participating in the
parent session (id:x).
As I'm finding out the child window session as ( id:Y) in userinfo.jsp,
Actually
i would like to get the information that is stored in parent session (x).

"SOME TIMES both PARENT AND CHILD WINDOWS are participating in the SAME
SESSION but not always".

And I tried to pass the parent session id to a other page that loads in
child window
using querystring, even that is not worked out as HttpServletContext can't
give
the HttpSession object using session id. Servlet 2.3 spec returns null
object if we
access
   HttpSession parentSession= sessionContext.getSession( anysessionid);
   //here parentSession is null
   // (*** TOMCAT4 servletAPI says the above method returns null and in
future
   // this  method will be removed ***).

Then the information that is stored in Parent window session (id: x) is
never get back.

Is it really bug in tomcat4.x other wise how come some times both windows
are participating
in same session?

Can any one jumped into this scenario with tomcat4.x ?

Many Thanks,
rayaku




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Help needed on new child window is treated in new session by JavaScript from parent window

Posted by Phillip Morelock <su...@phillipmorelock.com>.
> I'm not sure to say this is bug in Tomcat4.x,
> but I'm facing it with Tomcat4.x(all versions above  4).

it is more likely:
1.  This is a bug in the browser, not sending the cookie.
or
2.  Maybe you're not waiting long enough for the session to get associated?
Maybe you need to explicitly begin the session in the jsp that generates the
window-opening javascript.  And then maybe the javascript should be delayed
by a second or something to ensure that the session has been created.  Does
your function fire onload??  If so, make your call

onload="setTimeout('show()', 1000);"

or whatever -- can't remember javascript right now.

cheers
fillup


On 6/2/02 4:55 AM, "Yaman Kumar" <ya...@nous.soft.net> wrote:

> Hi,
> I'm not sure to say this is bug in Tomcat4.x,
> but I'm facing it with Tomcat4.x(all versions above  4).
> 
> My application is loaded in a parent window there user logs into application
> and
> in servlet I validate the user login info and keep so much information in
> session
> ( say id is x)and a new page is supplied by server and loaded in the parent
> window
> and parent window opens another window(child) using JavaScript
> that will hide all browser controls in child window (please look at the code
> that is
> in page loaded in parent window).
> 
> function show(){
> childWindow1=window.open("myapp/userinfo.jsp?name=<%
> =userName%>","child1","HEIGHT="+hit+",WIDTH="+wid+",top=0,left=
> 0,status=YES,scrollbars=YES");
> }
> 
> Problem: The child window that is opened from parent is not "ALWAYS"
> participating in the
> parent session (id:x).
> As I'm finding out the child window session as ( id:Y) in userinfo.jsp,
> Actually
> i would like to get the information that is stored in parent session (x).
> 
> "SOME TIMES both PARENT AND CHILD WINDOWS are participating in the SAME
> SESSION but not always".
> 
> And I tried to pass the parent session id to a other page that loads in
> child window
> using querystring, even that is not worked out as HttpServletContext can't
> give
> the HttpSession object using session id. Servlet 2.3 spec returns null
> object if we
> access
>  HttpSession parentSession= sessionContext.getSession( anysessionid);
>  //here parentSession is null
>  // (*** TOMCAT4 servletAPI says the above method returns null and in
> future
>  // this  method will be removed ***).
> 
> Then the information that is stored in Parent window session (id: x) is
> never get back.
> 
> Is it really bug in tomcat4.x other wise how come some times both windows
> are participating
> in same session?
> 
> Can any one jumped into this scenario with tomcat4.x ?
> 
> Many Thanks,
> rayaku
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>