• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

window.open in jsp file

 
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,

 
Rancher
Posts: 4117
47
  • 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.
 
Sheriff
Posts: 67269
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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!