aspose file tools*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "open another window" Watch "open another window" New topic
Author

open another window

Peter Gragert
Ranch Hand

Joined: Jan 16, 2001
Posts: 421
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
Peter
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: 421
Thanks ...
I just wanted to not use Javascript ...
So the a href= ... target=top is the only viable solution.
Thanks for your clarifying answers.
Peter
 
Consider Paul's rocket mass heater.
 
subject: open another window
 
Similar Threads
Unwanted browser window
Popup window not working
How to give the Target of pop-up window form as a frame in the main window
Listener/Events Help
closing applet by clicking button