• Post Reply Bookmark Topic Watch Topic
  • New Topic

window.open in jsp file

 
Atousa Pourdavood
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the jsp file which works fine but I need to open it in the new window. here is the code:


so instead of using

I believe I need to use

but it does not look right. Please advise .
Thanks,

 
Dave Tolls
Ranch Hand
Posts: 2284
25
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't request a new window from the server.
The client (ie browser) needs to open a new window as the target for the request it sends.

Also, you really shouldn't have all that Java code in your JSP.
It all belongs in a Servlet.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:You can't request a new window from the server.

Exactly. You can do this with window.open() using the URL as the window URL, or use the target="_blank" attribute on a link; either will open the URL in a new window.

Also, you really shouldn't have all that Java code in your JSP.
It all belongs in a Servlet.

This. So very very much this. You should have stopped putting Java code in a JSP 14 years ago. 14 years!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!