Mitch Pronschinske is a Senior Content Analyst at DZone. That means he writes and searches for the finest developer content in the land so that you don't have to. He often eats peanut butter and bananas, likes to make his own ringtones, enjoys card and board games, and is married to an underwear model. Mitch is a DZone Zone Leader and has posted 2576 posts at DZone. You can read more from them at their website. View Full User Profile

Spring Web Flow 2.2 Features Partial State Saving

08.05.2010
| 8941 views |
  • submit to reddit
The first milestone in Spring's next version of Web flow is available today.  The Spring Web Flow 2.2 developers are focused on increasing the amount of support for Java EE6's JSF 2.0.  Web Flow 2.1 was able to use JSF 2.0 dependencies without the Sun Facelets .jar that's often used with JSF 1.2, but 2.2 will have much more feature support.  This release will leverage core JSF 2.0 features and libraries.

Spring Web Flow can integrate tightly with Spring MVC, JSF, etc. to define page flows (composed of views and actions), manage state across requests, and allow page flow reuse.  In 2.2, JSF 2.0 Ajax processing capabilities will be leveraged with the <f:ajax> tag.  <f:ajax> also supports client-side event specification, and the specification of components included in the execute phase of request processing.  The tag can be nested in a tag or surround by other tags.

Web Flow 2.2 supports JSF 2's ResourceHandler API for serving resources.  The JSF component libraries facilitate adding resources transparently through an API or @ResourceDependency annotation.  JSF resource URLs point back to the Spring MVC DispatcherServlet in Web Flow, and a new Spring MVC HttpRequestHandler has been added to delegate resource requests to the JSF 2 mechanism that handles resources.  

Partial state saving from JSF 2 didn't work out of box in Web Flow 2.1, but thanks to general improvements in state saving with JSF 2, Web Flow 2.2 provides this support out of box.  With this support, Web Flow now ensures that a single FacesContext instance is used for the duration of a single flow request.  To prevent NullPointerExceptions on FacesContext, you need to add this FlowExecutionListener:
<webflow:flow-executor id="flowExecutor">
<webflow:flow-execution-listeners>
<webflow:listener ref="facesContextListener" />
</webflow:flow-execution-listeners>
</webflow:flow-executor>

<bean id="facesContextListener" class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener"/>

Composite components, JSR-303 validation, system events, and other JSF 2 features are expected to work in Web Flow 2.2 as well.  The project will also extend support for JSF 2 to include the Spring Faces component library.  Finally, there will be close integration with the PrimeFaces component library.  

Learn more about this release from the SpringSource blog.  You can download Spring Web Flow 2.2 M1 here or get it through the Maven milestone repository at http://maven.springframework.org/milestone.  Just like Spring Web Flow 2.1 - JDK 1.5, Spring 3, and Spring Security 3 are required.