aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes options for opening a new window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "options for opening a new window" Watch "options for opening a new window" New topic
Author

options for opening a new window

Andy Hahn
Ranch Hand

Joined: Aug 31, 2004
Posts: 225
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

Joined: Jan 10, 2002
Posts: 61419
    
  67

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 ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61419
    
  67

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

Joined: Aug 31, 2004
Posts: 225
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

Joined: Jan 10, 2002
Posts: 61419
    
  67

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

Joined: Aug 31, 2004
Posts: 225
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: options for opening a new window