Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

open URL in a new browser from a JSF backing bean

843842Mar 8 2006 — edited Mar 8 2006
I want to use commandButton action in jsf to launch a new browser instead of using commandLink.

How do you launch url in a new browser window by firing up a method in backing bean?

So far I am able to launch a URL within the same browser window. Here is my code:
In jsp file:

<h:commandButton rendered="#{openDataList.valueModifiable}" value="link" action="#{openDataList.link}" />

In backing bean:

...
public void link()
{
try{
FacesContext faces = FacesContext.getCurrentInstance();
faces.responseComplete();
ExternalContext context = faces.getExternalContext();
context.redirect("http://www...."); }
catch(java.io.IOException e)
{}

}
...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 5 2006
Added on Mar 8 2006
1 comment
1,460 views