open URL in a new browser from a JSF backing bean
843842Mar 8 2006 — edited Mar 8 2006I 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)
{}
}
...