Skip to content

Instantly share code, notes, and snippets.

Created February 20, 2018 08:04
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save CedricL46/be6fe5f7f7dd3dcac412948bd1447e76 to your computer and use it in GitHub Desktop.
How to fix a java.lang.IllegalStateException: Cannot forward a response that is already committed on a jsf action with sendRedirect/forward in ADF
//ADF : jsf :
<h:commandButton id="myBtnId"
value="click me"
//ADF : myBean :
public String doLogic() {
//Add business logic that will be executed first when the button is clicked
public void forwardAfterLogic(ActionEvent actionEvent) {
// Add forward logic here ...
//This will be execute after doLogic() in the second part of the lifecycle
ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContext();
HttpServletResponse response = (HttpServletResponse) ectx.getResponse();
String url = ectx.getRequestContextPath() + "/pageToRedirectTo";
try {
} catch (IOException e) {
//Do something and add trace
} catch (IllegalStateException il) {
//Do something and add trace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment