Skip to content

Instantly share code, notes, and snippets.

@fabriciocolombo
Created March 29, 2012 20:49
Show Gist options
  • Save fabriciocolombo/2243632 to your computer and use it in GitHub Desktop.
Save fabriciocolombo/2243632 to your computer and use it in GitHub Desktop.
JSF redirect url
public void redirect(String path) throws Exception {
FacesContext ctx = FacesContext.getCurrentInstance();
ExternalContext extContext = ctx.getExternalContext();
String url = extContext.encodeActionURL(ctx.getApplication().getViewHandler().getActionURL(ctx, path));
extContext.redirect(url);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment