This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

options for opening a new window

 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am running a jsp application on tomcat and need the ability to open a new window. The new window can be html but ideally I could use a jsp to build dynamic html. My first thought would be to use a window.open(). I am not sure if there are any limitations in doing this with jsp or if there is a better approach than the window.open(). One large drawback to using a window.open() is the IE information bar that appears when a supposed pop-up is encountered.

Thanks!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is entirely a client-side operation and hence you are limited to the mechanisms provided by HTML and JavaScript.

Remember, JSP is merely a server-side templating mechanism for formatting an HTML page to be sent to the browser.

Moved to the HTML forum.
[ June 13, 2006: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To be more specific...

Originally posted by Andy Hahn:
The new window can be html but ideally I could use a jsp to build dynamic html.


When you open a new window, the URL can refer to a JSP, an HTML page, an image or any other web resource. It doesn't matter.


My first thought would be to use a window.open(). I am not sure if there are any limitations in doing this with jsp or if there is a better approach than the window.open().


Once your page gets to the browser, it's just an HTML page. The fact that page was composed using JSP on the server is moot.


One large drawback to using a window.open() is the IE information bar that appears when a supposed pop-up is encountered.


An alternative to window.open is to use the target tag on a link or form. But that doesn't give you as much control.
[ June 13, 2006: Message edited by: Bear Bibeault ]
 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me ask this question:

If I want to be able to open an html page that has dynamically generated data in it, how would I accomplish that if I used the window.open() method?

For example,


I am not sure how to build up b.html and then open it.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The URL for the window.open() method can reference a JSP file. I'm not sure what you're not sure about.
 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the part I am not sure about:

If a.jsp uses the following javascript to open b.jsp:


And b.jsp looks like this:


Then how do I get b.jsp to pick up userName, assuming userName is declared in the Struts action class that forwards to a.jsp.

Thanks for the help!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic