This week's book giveaway is in the OCAJP forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
The moose likes Servlets and the fly likes Opening another browser window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Opening another browser window" Watch "Opening another browser window" New topic

Opening another browser window

Gabriel Cane
Ranch Hand

Joined: Mar 27, 2001
Posts: 39
How would I use either the servlet API or another Java API to open a new browser window from a servlet.
Furthermore, is it possible for servlets to interact with both browser windows interchangibly?

Sun Certified Programmer for the Java 2 Platform
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 61985

Gabriel, servlets operate completely on the server side and cannot directly cause browser actions. What your servlet can do is return javascript in the response that will cause another browser window to open. Or, depending on what your intent is, the URL that activated the servlet on the first place might be directed to a new browser window via a call, or through use of the "target" attribute on a form or anchor tag.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
It is sorta covered in the JavaRanch Style Guide.
subject: Opening another browser window