aspose file tools*
The moose likes Servlets and the fly likes Can a servlet open a new browser window? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Can a servlet open a new browser window?" Watch "Can a servlet open a new browser window?" New topic
Author

Can a servlet open a new browser window?

Vanchi Nathan
Ranch Hand

Joined: Feb 24, 2004
Posts: 107
Hello all,
Is it possible for a servlet to open a new browser window where an JSP page is displayed?
Your advise please!!!


Best regards,<br /> <br />vanchin
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61756
    
  67

Not directly.
It can, however, return a response containing Javascript that can perform this operation.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vanchi Nathan
Ranch Hand

Joined: Feb 24, 2004
Posts: 107
Thanks...
In this case, assume the servlet uses an session object; will the same session object be visible in the new browser window?
please advise...
john smith
Ranch Hand

Joined: Mar 04, 2004
Posts: 75
It can either behave in a stateful way and put what ever data you need in the session, or pass the data using hidden form fields or by programatically adding the data to the request.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Originally posted by Lokanathan Vanchinathan:
In this case, assume the servlet uses an session object; will the same session object be visible in the new browser window?

Yes and no. The new window should automatically take up the existing session, but there is a bug in Internet Explorer (v5?) where it creates a new session for the pop-up window. You can use url rewriting to force the second window to take up the existing session.
Dave
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Originally posted by David O'Meara:

Yes and no. The new window should automatically take up the existing session, but there is a bug in Internet Explorer (v5?) where it creates a new session for the pop-up window. You can use url rewriting to force the second window to take up the existing session.
Dave


No there's not
There's a bug in some versions of Netscape where a new window will be a separate process thus a new session, not in IE (at least not in any 5.x or 6.x version, maybe in very old ones).
I've been programming against IE for years (since about 1999) and never encountered any problems.


42
Anna Hays
Ranch Hand

Joined: Nov 09, 2003
Posts: 131
It could be using cookie to keep your session id. IE don't seems like share cookies between browsers. Well IE does that to me but not Netscape and Mozilla when I use cookies based authentication.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can a servlet open a new browser window?