Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

open another window

 
Peter Gragert
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic