aspose file tools
The moose likes JSF and the fly likes Open New Window using h:commandButton Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Open New Window using h:commandButton" Watch "Open New Window using h:commandButton" New topic
Author

Open New Window using h:commandButton

Varshini Priya
Ranch Hand

Joined: Feb 17, 2008
Posts: 83

I need some help on how to open a page in a new Tab on click of the command button. I know I can acheive this using the javascript. But I would like to acheive this using JSF code and not Javascript. Im using JSF2.0. I have already been able to establish this using commandLink by adding target="_blank". But I would like to acheive the same using commandButton. Also is there anyway if we can specify the javascript code in the backend to open the page in a new tab?? please assist.
Thanks in Advance
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14456
    
    7

The JSF commandButton control does not support the target attribute, unlike the commandLink. What most people do is fake it by decorating a commandLink to look like a button.

None of the popular J2EE servers have JavaScript interpreters built into them, so any JavaScript code would have to run on the client.


Customer surveys are for companies who didn't pay proper attention to begin with.
Varshini Priya
Ranch Hand

Joined: Feb 17, 2008
Posts: 83

Thanks for the response Tim. I was able to acheive this via the below code . Thought of sharing it, since it might be useful for someone else.


 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Open New Window using h:commandButton
 
Similar Threads
Javascript
how to open page in new tab
Open JSP page in new tab(browser) from request from servlet
How to display an image while waiting for PDF to render?
Expiring session