diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/FlowActionListener.java b/spring-faces/src/main/java/org/springframework/faces/webflow/FlowActionListener.java index e67f90f1..9212d74a 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/FlowActionListener.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/FlowActionListener.java @@ -67,6 +67,8 @@ public class FlowActionListener implements ActionListener { logger.debug("No action event detected"); context.getExternalContext().getRequestMap().remove(JsfView.EVENT_KEY); } + // tells JSF lifecycle that rendering should now happen and any subsequent phases should be skipped + // required in the case of this action listener firing immediately (immediate=true) before validation context.renderResponse(); } } diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/FlowFacesContext.java b/spring-faces/src/main/java/org/springframework/faces/webflow/FlowFacesContext.java index 928c9409..d3000a59 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/FlowFacesContext.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/FlowFacesContext.java @@ -167,6 +167,7 @@ public class FlowFacesContext extends FacesContext { } public void renderResponse() { + // stored in flash scope to survive a redirect when transitioning from one view to another context.getFlashScope().put(RENDER_RESPONSE_KEY, Boolean.TRUE); } diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfView.java b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfView.java index df6372fb..38a0b12c 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfView.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfView.java @@ -103,6 +103,7 @@ public class JsfView implements View { try { if (restored && !facesContext.getResponseComplete() && !facesContext.getRenderResponse()) { facesLifecycle.execute(facesContext); + // TODO move this and renderResponse behavior into lifecycle validateModel(facesContext); } } finally { diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfViewFactory.java b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfViewFactory.java index 72fa6f0b..9076c742 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfViewFactory.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfViewFactory.java @@ -68,6 +68,8 @@ public class JsfViewFactory implements ViewFactory { FacesContext facesContext = FlowFacesContext.newInstance(context, lifecycle); try { if (!facesContext.getRenderResponse()) { + // only publish a RESTORE_VIEW event if this is the first phase of the lifecycle + // this won't be true when this method is called after a transition from one view-state to another JsfUtils.notifyBeforeListeners(PhaseId.RESTORE_VIEW, lifecycle, facesContext); } ViewHandler viewHandler = facesContext.getApplication().getViewHandler();