The moose likes Servlets and the fly likes open another window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "open another window" Watch "open another window" New topic

open another window

Peter Gragert
Ranch Hand

Joined: Jan 16, 2001
Posts: 424
Hallo and merry Christmas!
I have the following question.
My servlet sends a *.html file opening up at the clients screen. I want to include a 'hint' button which opens a NEW window. With Javascript, if enabled would be very easy, but I would like to do this by a servlet.
Thus the idea: the button gets the name 'HINT' and is a submit-button calling a servlet but this servlet should open up another window, such that the old-one does not vanish.
At this moment I solved this problem by a href and target=top , but I am curious about a servelet-solution ...
Thanks if you know and let us know
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
You are confusing your technologies. A Servlet is a server-side process, opening a new browser window is a client-side process. The closest a Servlet can get is to send back HTML + DHTML that opens the new window. However, it is an important distinction to recognize that the servlet itself is not opening the window.
Michael Mendelson
Ranch Hand

Joined: Dec 19, 2000
Posts: 73
Chris is right. A servlet cannot do this, since the client's browser itself controls whether another a link appears in a new window.
The best you can do is to use Javascript.
Peter Gragert
Ranch Hand

Joined: Jan 16, 2001
Posts: 424
Thanks ...
I just wanted to not use Javascript ...
So the a href= ... target=top is the only viable solution.
Thanks for your clarifying answers.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: open another window
It's not a secret anymore!