This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Servlets and the fly likes Child Window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Child Window" Watch "Child Window" New topic

Child Window

Prabhu Chandrasekaran
Ranch Hand

Joined: Oct 14, 2000
Posts: 36
Just like in JavaScript, can we open a servlet in a new window using java. If so, how? A piece of code can be very useful if possible.
Advance Thanks ....

Rob Whelan
Ranch Hand

Joined: Oct 18, 2000
Posts: 33
I'm not sure if you understand that servlets are entirely server-side software... basically, as far as a browser is concerned, a URL that accesses a servlet is the same as any other URL.
If you want to open the returned HTML from a servlet in a new window, use JavaScript, or just the "target" parameter in your anchor or form tag:
<A href="/servlet/MyServlet" target="_blank">open servlet page</A>
- or -
<FORM action="/servlet/MyServlet" method="POST" TARGET="_blank"> form contents... </FORM>
If you're displaying the page from an applet, just use the standard Applet call showDocument( URL, "_blank" ) to do that. If you need to POST data to that servlet and display the result to a new window... Well, I've done it, but you need to use Netscape's LiveConnect (yes, IE supports it) to communicate with JavaScript.
[This message has been edited by Rob Whelan (edited October 20, 2000).]
I agree. Here's the link:
subject: Child Window
It's not a secret anymore!