Spring Web Flow 2.2.0.M1 Released |
|

I'm pleased to announce the first milestone of Spring Web Flow 2.2 is now available for download. The release is also available through the Maven milestone repository at http://maven.springframework.org/milestone. As with Spring Web Flow 2.1, this release requires JDK 1.5, Spring 3 and Spring Security 3.
The main focus of the release is to address the needs of JSF users by extending the list of supported JSF 2 features. Not long ago Web Flow 2.1 made it possible to use JSF 2 dependencies without the need for the separate Sun Facelets jar that is commonly used with JSF 1.2 today.
In Spring Web Flow 2.2 you can look forward to taking advantage of core JSF 2 features and JSF 2 component libraries. More on component libraries later in this post. First here is an overview of the new features.
JSF 2 Ajax Requests
JSF 2 defines client and server side facilities for processing Ajax requests. You can add Ajax behavior to a component with the <f:ajax> tag as follows:
<h:commandButton value="More Results" action="next">
<f:ajax render="@form" />
</h:commandButton>
When the above button is pressed an Ajax request is sent to the server that will result in partial request processing, rendering, and an update to the form the button belongs to.
The <f:ajax> tag also supports other attributes such as "event" for specifying client-side events (blur, mouseover, etc) and "execute" for specifying components that should be included in the execute phase of the request processing lifecycle. The <f:ajax> tag can be nested inside or surround other tags. There is also a JavaScript API. See section 10.4.1.1 and chapter 14 of the JSF 2 spec for more details and examples.
If you are a Web Flow 2 user you will find it familiar to process the above request as you do today:
<view-state id="reviewHotels">
<transition on="next">
<evaluate expression="searchCriteria.nextPage()" />
</transition>
</view-state>
The transition on "next" does not have a target view state. That will keep us in the current view while advancing the SearchCriteria backing bean to the next page. To ensure rendering happens without a client-side redirect (the POST-redirect-GET pattern), you need to configure Web Flow to be able to recognize JSF 2 Ajax requests:
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor" />
<property name="ajaxHandler">
<bean class="org.springframework.faces.webflow.JsfAjaxHandler"/>
</property>
</bean>
The booking-faces sample in the 2.2.0.M1 release uses the <f:ajax /> tag throughout including use cases such as search result pagination and Ajax-based form validation.
JSF 2 Resource Requests
JSF 2 introduces a ResourceHandler API for serving resources (images, .js, .css files) packaged relative to the web application root under /resources/** or on the classpath under META-INF/resources/**. JSF component libraries can add resources transparently via an API or @ResourceDependency annotation. Alternatively you can also add an <outputScript> tag to the view.
JSF renders resource URLs such that they point back to the same servlet like this:
/myApp/myServlet/javax.faces.resources/
Note the "/javax.faces.resources" segment that comes after the servlet mapping. This is what distinguishes it as a JSF resource requests.
In Web Flow, JSF resource URLs point back to the Spring MVC DispatcherServlet. To handle such requests a new Spring MVC HttpRequestHandler is provided to delegate resource requests to the JSF 2 resource handling mechanism. Below is the configuration required to configure this handler. The final release will simplify this configuration.
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings" value="/javax.faces.resource/**=jsfResourceHandler"/>
</bean>
<bean class="org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter" />
<bean id="jsfResourceHandler" class="org.springframework.faces.webflow.FacesJsfResourceRequestHandler"/>
The booking-faces sample in the 2.2.0.M1 release contains the necessary configuration.
Partial State Saving
Partial state saving is arguably one of the most important changes in JSF 2 (Facelets only). The way it works is, rather than storing the entire component tree state for every view the partial state saving algorithm always restores the tree to its initial state and then applies and keeps track of what's changed only. This rational is that component tree changes are likely to be smaller than the full component tree state thus resulting in less memory usage.
In Web Flow, the JSF component tree state has always been stored in a view-scoped Web Flow variable rather than directly in the HTTP session. Unfortunately to achieve that in JSF 1.2, Web Flow had to take over the entire state saving algorithm. This is why partial state didn't work out of the box in Web Flow 2.1 and had to be disabled through the "javax.faces.PARTIAL_STATE_SAVING" context parameter in web.xml.
General improvements in JSF 2 state saving made it possible to delegate to the standard JSF StateManager implementation and plug in a custom ResponseStateManager to override only the parts that do the actual reading and writing of component state. That is what Web Flow 2.2 does to provide support for partial state saving.
The change has been tested with Mojarra and in particular Mojarra version 2.0.3 (recommended version). If you use the Apache MyFaces JSF 2 implementation for the time being you will need to continue to use the "javax.faces.PARTIAL_STATE_SAVING" parameter to disable partial state saving. Unfortunately in MyFaces it wasn't as simple to customize how state is where state is read from and written to so it will take a little more time.
Single FacesContext Per Request
Part of the changes for partial state saving required making sure a single FacesContext instance is used for the duration of a single flow request. This is probably a welcome change for JSF users as evidenced by a few of your comments in JIRA. To avoid getting a NullPointerException on FacesContext you will 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"/>
This is needed regardless of the JSF version used.
More JSF 2 Features
The only features that aren't supported are the ones where Web Flow provides core value including navigation and scopes. JSF 2 uses conventions to simplify navigation rules, adds conditional navigation, and provides view, flash, and custom scopes. You will find that Web Flow continues to provide significant value in both of these areas.
View parameters is another feature that isn't supported. Web Flow does provide a way to access request parameters and to bind them to fields of scoped beans. If you however have any good use cases in mind please do provide us with feedback.
Any other features not already mentioned (composite components, JSR-303 validation, system events, etc) are expected to work. With regards to composite components the following Mojarra issue may affect you. If so please vote for it.
JSF 2 Component Libraries
In addition to its JSF integration, Spring Web Flow currently ships with a small library of components. The Spring Faces component library builds on the Dojo JavaScript toolkit and provides Ajax behavior, resource handling, and client-side validation in a progressive enhancement style. Much of this overlaps with what JSF 2 provides. Hence we have a choice to either extend support for JSF 2 to include the Spring Faces component library or to integrate closely with other component libraries popular in the JSF community. We believe the latter option will provide significantly more value to you.
At this point I am happy to announce we are working closely with the team behind PrimeFaces to bring you a close integration with its library of components. PrimeFaces is the first component library to support JSF 2 and is rapidly gaining in popularity. Much like Spring Faces it builds on a client-side JavaScript toolkit (jQuery) and has an impressive array of components that is growing by the day. If you haven't checked out the PrimeFaces component showcase please do so.
As a result you can expect Spring Web Flow 2.2 to release with JSF 2 samples featuring PrimeFaces components demonstrating effective use of Web Flow, JSF 2 and a first-class JSF 2 component library.
Conclusion
Web Flow 2.2 will be the first release to provide support for core JSF 2 features and close integration with the PrimeFaces component library. If you're a JSF user I hope you will find this an exciting step forward. To try the release please download it, run the updated booking-faces sample, and give us your feedback. You can expect a release candidate at the end of this month in sync with the PrimeFaces 2.2 release.
Meanwhile work on Web Flow 3 is continuing towards a first milestone. The defining feature of Web Flow 3 is Java flow definitions. The JSF work being done in the 2.2 branch will feed into the 3.0 branch.
Similar Posts
- Spring Web Flow 2.0 M4 – Feedback Requested
- Spring For JavaServerFaces – TSSJS Slides and Demos
- The Spring Web Flow 2.0 Vision
- Spring Web Flow Bean Scopes and JSF
- What Spring Web Flow Offers JSF Developers





Julien Dubois says:
Added on August 5th, 2010 at 7:15 amThis means the "sf" component library is end-of-lifed, which I kind of expected. However, previous versions of Spring Faces where tightly integrated with RichFaces, which I think is the de facto standard JSF librairy for Spring users. How does this move to Prime Faces affect existing users? Will Rich Faces and A4J continue to be supported?
Michael Warren says:
Added on August 5th, 2010 at 7:52 amPrimefaces rocks.
Rossen Stoyanchev (blog author) says:
Added on August 5th, 2010 at 8:03 amHi Julien, I think it's worth making a distinction between the JSF integration in Spring Web Flow and the Spring Faces component library. The JSF integration in Spring Web Flow is where we can provide integration with component libraries such as PrimeFaces and RichFaces.
The Spring Faces component library on the other hand will not be extended to support JSF 2 support. With JSF 2 in the picture we think users will get more value from popular JSF component libraries.
PrimeFaces is the only component library that supports JSF 2 today. By collaborating closely we'll ensure that those users relying on Spring Faces components today have a clear and easy path when they decide to upgrade to JSF 2.
Julien Dubois says:
Added on August 5th, 2010 at 8:19 amHi Rossen, I don't think it's going to be easy to migrate from Spring Faces/Rich Faces/A4J when you have a lot of projects using all 3 technologies. That's a lot of code to change, and a lot of testing to do again.
Besides, it means we must change the component library vendor from JBoss to PrimeFaces, which isn't easy to do at all. Having support from a company like Redhat is very important for my clients.
Antonio Goncalves says:
Added on August 5th, 2010 at 8:40 am@Rossen, correct me if I'm wrong but I though Spring Web Flow 2.2 doesn't fully support JSF 2.0 yet (I suppose that's for a near future release). On the other hand, RichFaces 4 will also support JSF 2.0 in the near future. So it looks like it's just a matter of time that another component library will implement JSF 2.
Again, correct me if I'm wrong, but I thought that one beauty of JSF 2.0 was to standardize how components interact with each other. Last year at Devoxx there was a JSF 2.0 BOF (with D. Allen, A. Schwartz & P. Muir) and they were saying that RichFaces components could interact with PrimeFaces components for example.
Rossen Stoyanchev (blog author) says:
Added on August 5th, 2010 at 9:12 am@Julien, I don't think this means you have to switch from RichFaces. RichFaces 4 (currently in M1) will be the version to support JSF 2. We'll make sure that works with Spring Web Flow as well. I'd also appreciate your comments on what Spring Faces components you're using right now in combination with RichFaces.
@Antonio, Spring Web Flow 2.1 (already released) has basic JSF 2 support. Spring Flow 2.2 (the subject of this post) will support all the features outlines above. Is there anything that you see is missing? As for mixing libraries, yes that should work better in JSF 2.
Antonio Goncalves says:
Added on August 5th, 2010 at 9:15 am@Rossen so that means when everybody has reach final release (Spring Web Flow 2.2 and RichFaces 4.0) things should be smooth and work together. That's good to know. Thanks
Julien Dubois says:
Added on August 5th, 2010 at 9:32 amHi Rossen,
The Spring Faces components that are very widely used are commandLink and commandButton.
The other components are less popular as most projects want their very own calendar or input text components. For example, a calendar will be a heavily modified versions of the Rich Faces calendar component, because the end user wanted to take into account French holidays.
As long as you make sure Spring Webflow continues to play well with Rich Faces I'm a happy man: the Spring Faces components are very, very minor compared to the Rich Faces and A4J ones.
Andy Carson says:
Added on August 5th, 2010 at 12:32 pm@Rossen, could you comment on the status of WebFlow 2.2 with respect to portlets please. I'm particularly interested in the position re Portlet 2.0 (JSR 286) and support for JSF portlets.
Rossen Stoyanchev (blog author) says:
Added on August 5th, 2010 at 4:20 pmAndy, the Apache MyFaces JSF Portlet Bridge 2, which supports Portlet API 2.0 and JSF 1.2 is currently in alpha. It tracks JSR 329 which is in second early draft. To my knowledge Sun's JSF portlet bridge supports Portlet 1.0 only. That said the MyFaces portlet bridge developres has been quite responsive and it may be possible to get that working in Web Flow 2.2 but it will more likely be a subsequent release.
I've created a ticket where you can leave comments or subscribe to watch for further developments:
https://jira.springframework.org/browse/SWF-1379
Phil Webb says:
Added on August 6th, 2010 at 7:25 amHi Rossen, Will Web Flow 2.2 continue to support older versions of JSF or is JSF 2.0 now a minimum requirement?
Rossen Stoyanchev (blog author) says:
Added on August 6th, 2010 at 7:45 amHi Phil, good question. Web Flow 2.2 will continue to support JSF 2.0 and 1.2 (as was the case with Web Flow 2.1).
Mehmet Salgar says:
Added on August 18th, 2010 at 1:45 amHi everybody,
because of the blog announcement ([B]http://blog.springsource.com/2010/08/05/spring-web-flow-2-2-0-m1-released/[/B]) that Primefaces and SWF would work closely, I start experimenting with this combination and I am having some problems….
First of all, the class FlowFacesContextLifecycleListener inside of the SpringFaces, is I guess responsible to initialize the FacesContext for SWF, but is not configured in any faces-config.xml or referenced anywhere.
As a result of it, I am getting the following exception……
java.lang.NullPointerException
at org.springframework.faces.webflow.JsfViewFactory.getView(JsfViewFactory.java:76)
at org.springframework.webflow.engine.ViewState.doEnter(ViewState.java:206)
So is there an another way of configuring this, so it is my mistake…..
Or when I read the blog and comments again, there is notion that it is not necessary anymore to place spring-faces inside of war ("The Spring Faces component library on the other hand will not be extended to support JSF 2 support. With JSF 2 in the picture we think users will get more value from popular JSF component libraries. ")?????
Secondly, PrimeFaces provides no AjaxHandler at the moment for 2.2.0.RC-SNAPSHOT, is this correct, is it not necessary anymore?
And as a third point, there is a problem with 2.2.0.M1 webflow pom, it references the spring js library, version 2.2.0.M1 but it is not in the Milestone repository….
And finally, an artifact with the name org.springframework.web for version 3.0.3 is also not in the repository or our nexus repository has problems….
Can anybody help me with these points….
Marc Jahn says:
Added on August 19th, 2010 at 5:03 amI'm experiencing the same as Mehmet Salgar does.
java.lang.NullPointerException
at org.springframework.faces.webflow.JsfViewFactory.getView(JsfViewFactory.java:76)
at org.springframework.webflow.engine.ViewState.doEnter(ViewState.java:206)
Alex says:
Added on August 19th, 2010 at 6:15 amMaven repo URL should be – http://repository.springsource.com/maven/bundles/milestone
Rossen Stoyanchev (blog author) says:
Added on August 20th, 2010 at 12:11 am@Mehmet, please have a look at the booking-faces sample in the 2.2.0.M1 distribution or in the 2.2 branch. The sample is configured with the required FlowFacesContextLifecycleListener listener in src/main/webapp/WEB_INF/config/webflow-config.xml. There is a ticket in JIRA to simplify the configuration through a custom namespace element but for now all that you need is in the sample.
The spring-faces.jar is required. It contains both the Spring Web Flow integration with JSF and the Spring Faces components. Using the Spring Faces components is optional.
There is no need for a PrimeFaces AjaxHandler. As of a PrimeFaces 2.2 all Ajax interaction is standard JSF 2 Ajax request processing so just use the handler provided for JSF 2 (JsfAjaxHandler).
m says:
Added on August 20th, 2010 at 4:16 pmI am attempting to run spring-webflow-2.2.0.M1 booking-faces example in Netbeans but the springsource repositories cannot be found. Is the repo down? Can someone point me in the right direction?
luistrigueiros says:
Added on August 21st, 2010 at 6:20 pmHi,
.
Very good directions indeed, currently working on the same set of issues on my project.
So 2.2.0 is badly needed,
I have looked at the sample showcase in svn, and would like to make a suggestion please make it simpler, featuring only the Faces/Webflow integration thus leaving out the mvc stuff.
Thus you will your target better because people will mostly be conserned with webflow addons to JSF.
James says:
Added on August 25th, 2010 at 1:17 pmI have a web application built on these technologies.
Myfaces 2.0.1
Richfaces 3.3.3
Spring web flow 2.0.8
The application is working fine with above jar files. After I switch to SWF 2.2 jars, I got the following error when I start the application. I did not change any configuration and the home page is just plain JSF page. I see the SWF libraries is invoked here and don't understand why. It should straight JSF view display. Any feedback is appreciated.
[8/24/10 17:51:59:171 CDT] 00000021 RedirectTrack I org.apache.myfaces.custom.redirectTracker.Redirect TrackerManager createRedirectTrackerManager No context init parameter 'org.apache.myfaces.redirectTracker.MAX_REDIRECTS' found, using default value 20
[8/24/10 17:51:59:187 CDT] 00000021 HtmlLabelRend W Attribute 'for' of label component with id j_id66:j_id70 is not defined
[8/24/10 17:51:59:453 CDT] 00000021 HtmlGridRende W PanelGrid j_id66:j_id81 has not enough children. Child count should be a multiple of the columns attribute.
[8/24/10 17:51:59:453 CDT] 00000021 HtmlGridRende W PanelGrid j_id66:j_id84 has not enough children. Child count should be a multiple of the columns attribute.
[8/24/10 17:51:59:937 CDT] 00000021 viewhandler E Error Rendering View[/index.xhtml]
java.lang.NullPointerException
at org.springframework.faces.webflow.FlowViewResponse StateManager.writeState(FlowViewResponseStateManag er.java:84)
at org.ajax4jsf.application.AjaxStateManager.writeSta te(AjaxStateManager.java:296)
at org.ajax4jsf.application.AjaxStateManager.writeSta te(AjaxStateManager.java:258)
at org.springframework.faces.webflow.FlowViewStateMan ager.writeState(FlowViewStateManager.java:109)
at com.sun.facelets.FaceletViewHandler.renderView(Fac eletViewHandler.java:622)
at org.springframework.faces.webflow.FlowViewHandler. renderView(FlowViewHandler.java:99)
at org.ajax4jsf.application.ViewHandlerWrapper.render View(ViewHandlerWrapper.java:100)
at org.ajax4jsf.application.AjaxViewHandler.renderVie w(AjaxViewHandler.java:176)
at org.springframework.faces.webflow.FlowViewHandler. renderView(FlowViewHandler.java:99)
at org.apache.myfaces.lifecycle.RenderResponseExecuto r.execute(RenderResponseExecutor.java:85)
at org.apache.myfaces.lifecycle.LifecycleImpl.render( LifecycleImpl.java:239)
at org.apache.myfaces.custom.ppr.PPRLifecycleWrapper. render(PPRLifecycleWrapper.java:84)
at javax.faces.webapp.FacesServlet.service(FacesServl et.java:191)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.ser vice(ServletWrapper.java:1146)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.ser vice(ServletWrapper.java:1087)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.d oFilter(WebAppFilterChain.java:145)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(Base XMLFilter.java:206)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseF ilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHa ndleRequest(BaseFilter.java:388)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter .java:515)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapp er.doFilter(FilterInstanceWrapper.java:190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.d oFilter(WebAppFilterChain.java:130)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._ doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager .doFilter(WebAppFilterManager.java:840)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager .doFilter(WebAppFilterManager.java:683)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.han dleRequest(ServletWrapper.java:589)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.h andleRequest(ServletWrapper.java:534)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispat cher.forward(WebAppRequestDispatcher.java:321)
at com.ibm.ws.webcontainer.servlet.FilterProxyServlet .dispatch(FilterProxyServlet.java:61)
at com.ibm.ws.webcontainer.servlet.FilterProxyServlet .service(FilterProxyServlet.java:41)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.ser vice(ServletWrapper.java:1146)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.ser vice(ServletWrapper.java:1087)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.d oFilter(WebAppFilterChain.java:145)
at com.baxter.biolife.easyscheduler.presentation.util .SessionFilter.doFilter(SessionFilter.java:104)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapp er.doFilter(FilterInstanceWrapper.java:190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.d oFilter(WebAppFilterChain.java:130)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._ doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager .doFilter(WebAppFilterManager.java:840)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager .invokeFilters(WebAppFilterManager.java:750)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager .invokeFilters(WebAppFilterManager.java:703)
at com.ibm.ws.wswebcontainer.filter.WebAppFilterManag er.invokeFilters(WebAppFilterManager.java:132)
at com.ibm.ws.webcontainer.extension.DefaultExtension Processor.invokeFilters(DefaultExtensionProcessor. java:856)
at com.ibm.ws.webcontainer.extension.DefaultExtension Processor.handleRequest(DefaultExtensionProcessor. java:574)
at com.ibm.ws.wswebcontainer.extension.DefaultExtensi onProcessor.handleRequest(DefaultExtensionProcesso r.java:113)
at com.ibm.ws.webcontainer.webapp.WebApp.handleReques t(WebApp.java:3548)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequ est(WebGroup.java:269)
at com.ibm.ws.webcontainer.WebContainer.handleRequest (WebContainer.java:818)
at com.ibm.ws.wswebcontainer.WebContainer.handleReque st(WebContainer.java:1478)
at com.ibm.ws.webcontainer.channel.WCChannelLink.read y(WCChannelLink.java:126)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.handleDiscrimination(HttpInboundLink.java:458)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.handleNewInformation(HttpInboundLink.java:387)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.ready(HttpInboundLink.java:267)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialRe adCallback.sendToDiscriminators(NewConnectionIniti alReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialRe adCallback.complete(NewConnectionInitialReadCallba ck.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListe ner.futureCompleted(AioReadCompletionListener.java :165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallbac k(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletion Actions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture .java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHand ler.java:196)
at com.ibm.io.async.ResultHandler.runEventProcessingL oop(ResultHandler.java:751)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler .java:881)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j ava:1497)
Rossen Stoyanchev (blog author) says:
Added on August 25th, 2010 at 2:04 pmJames, this is a known issue:
https://jira.springframework.org/browse/SWF-1383
The fix was added today so you can get the nightly snapshot tomorrow:
James says:
Added on August 25th, 2010 at 2:21 pmThanks for the good news. Another question is that whether there is any way I can access JSF facescontext in SWF 2.2? I have searched the answer for several weeks and have not got good one.
Rossen Stoyanchev (blog author) says:
Added on August 26th, 2010 at 2:17 amYou should be able to access it as usual, FacesContext.getCurrentInstance()
James says:
Added on August 26th, 2010 at 10:27 amI downloaded the nightly built spring-webflow-2.2.0.CI-9.zip. I think he it is the latest nightly build. I run the code. I still got the same exceptions. I looked at the jira ticket. The stack trace in the jira ticket is different from mine. In the end, the exception occurred at org.springframework.faces.webflow.FlowViewResponse StateManager.writeState. But I wonder whether they are the same issue. In my case, it is at org.ajax4jsf.application.AjaxStateManager.writeState calls the
org.springframework.faces.webflow.FlowViewResponse StateManager.writeState. What is your thought on this?
James says:
Added on August 26th, 2010 at 10:40 amanother question I have is why spring web flow function is called. It is just home page (plain JSF view). I have not started spring web flow at this point.
Rossen Stoyanchev (blog author) says:
Added on August 27th, 2010 at 2:52 amJames, the change you need is in CI27:
http://build.springsource.org/browse/SWF-22XSNAPSHOT-27/commit
Please use the forum or the JIRA if you have further questions.
Thanks
James says:
Added on August 27th, 2010 at 10:20 amThe original issue is fixed. I can start my homepage which means non-swf request is processed. But after I login, I get the exceptions. I create a jira ticket for this issue. Hope it can be resovled quickly.
https://jira.springframework.org/browse/SWF-1391
James says:
Added on September 1st, 2010 at 10:26 amI can start spring web flow now. But once I start navigation, I got exception. I create a ticket for this issue.
https://jira.springsource.org/browse/SWF-1393
Donny says:
Added on November 13th, 2010 at 10:26 pmHi Rossen, is the next release going to include org.springframework.faces.primefaces.PrimeRenderFragmentsListener in the jar? i find it's troublesome to create the class just to experiment with PrimeFaces in small projects
Rossen Stoyanchev (blog author) says:
Added on November 15th, 2010 at 5:00 amDonny, please create a ticket and we'll get something in.
Donny says:
Added on November 15th, 2010 at 8:29 amThanks a lot, Rossen, I created a ticket: https://jira.springframework.org/browse/SWF-1424
Suman Sohal says:
Added on December 6th, 2010 at 10:15 amHi Rossen,
I am using Tomcat 6.0 and jdk 1.6_20 with Primefaces and SWF in STS 2.5.1.I am experiencing a problem using SWF with Primefaces components such as commandbutton and commandlink. In my project,web flow was working fine until I have added tag in the mvc-config.xml. I have added this tag because it was giving javascript error "Primes is undefined".After adding this tag, p:commanButton and p:commandlink stopped working . I am not able to navigate to another screen.Please help me out. I am desperately needing your help.
This issue is already reported
https://jira.springframework.org/browse/SWF-1426?focusedCommentId=61138#action_61138.
But here it says ajax="false will resolve the problem". If I follow the suggestion given here,there will be no point of using PrimeFaces components without AJAX
Rossen Stoyanchev (blog author) says:
Added on December 6th, 2010 at 10:45 amSuman, I've posted an answer on the JIRA as well. That issue is now fixed and will be in Spring Web Flow 2.3.0. You can also use plain commandButton with an f:ajax tag within it.
h_tayebi says:
Added on December 18th, 2010 at 2:10 ami using flowwing config in project :
error, when i want to start project :
javax.servlet.ServletException: No adapter for handler [org.springframework.webflow.mvc.servlet.FlowController@1c76093]: Does your handler implement a supported interface like Controller?
org.springframework.web.servlet.DispatcherServlet.getHandlerAdapter(DispatcherServlet.java:982)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:770)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
h_tayebi says:
Added on December 18th, 2010 at 2:11 amhello,i using flowwing config in project :
error, when i want to start project :
javax.servlet.ServletException: No adapter for handler [org.springframework.webflow.mvc.servlet.FlowController@1c76093]: Does your handler implement a supported interface like Controller?
org.springframework.web.servlet.DispatcherServlet.getHandlerAdapter(DispatcherServlet.java:982)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:770)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
Alex Lopez says:
Added on April 28th, 2011 at 8:59 amHi Rossen,
please would you care to explain the correct way to make flows/facelets into external jars (classpath) when using Spring 3.0.5 with SWF spring-faces 2.3.0 mojarra 2.0.3.
I thing the troubles I'm having are related to:
https://jira.springsource.org/browse/SWF-1319
But the solutions I found are directed to jsf 1.2 or jsf 2 without webflow…
By the stacktrace I'm sure webflow knows perfectly the location of the view to show, it just throws the exception… so I'm assuming I must have something bad with the configuration in either web.xml, faces-config or webflow.
Faces-resources comming from other jars are handled just fine, even flows are executed, but when it's time to show the view:
SEVERE: Servlet.service() for servlet [springmvc] in context with path [/site] threw exception [Request processing failed; nested exception is org.springframework.webflow.execution.FlowExecutionException: Exception thrown in state 'view' of flow 'outside'] with root cause
java.lang.IllegalStateException: A ContextResource is required to get relative view paths within this context; the resource was URL [jar:file:/C:/Program Files/Apache Software Foundation/Tomcat 7.0/webapps/site/WEB-INF/lib/outsider.jar!/META-INF/views/outside/view.xhtml]
at org.springframework.faces.webflow.FlowViewHandler.resolveResourcePath(FlowViewHandler.java:126)
at org.springframework.faces.webflow.FlowViewHandler.restoreView(FlowViewHandler.java:82)
at org.springframework.faces.webflow.JsfViewFactory.getView(JsfViewFactory.java:105)
at org.springframework.webflow.engine.ViewState.resume(ViewState.java:193)
at org.springframework.webflow.engine.Flow.resume(Flow.java:545)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:261)
at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
at org.springframework.faces.webflow.JsfFlowHandlerAdapter.handle(JsfFlowHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:380)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Thanks!
Murali says:
Added on June 16th, 2011 at 5:28 amHi Rossen,
this blog helped me a lot.
for partial re-rendering i used a4j:commandButton rather h:commandButton f:ajax
it throughs java.lang.UnsupportedOperationException. not sure webflow needs to fix this or richfaces. a discussion does here: http://community.jboss.org/thread/166688
Complete StackTrace:
15:49:31,202 ERROR [STDERR] java.lang.UnsupportedOperationException
15:49:31,202 ERROR [STDERR] at java.util.AbstractList.add(AbstractList.java:131)
15:49:31,202 ERROR [STDERR] at java.util.AbstractList.add(AbstractList.java:91)
15:49:31,202 ERROR [STDERR] at java.util.AbstractCollection.addAll(AbstractCollection.java:305)
15:49:31,202 ERROR [STDERR] at org.richfaces.context.ExtendedPartialViewContextImpl.visitActivatorAtRender(ExtendedPartialViewContextI
mpl.java:346)
15:49:31,202 ERROR [STDERR] at org.richfaces.context.ExtendedPartialViewContextImpl.processPartialRenderPhase(ExtendedPartialViewConte
xtImpl.java:257)
15:49:31,202 ERROR [STDERR] at org.richfaces.context.ExtendedPartialViewContextImpl.processPartial(ExtendedPartialViewContextImpl.java
:206)
15:49:31,202 ERROR [STDERR] at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:179)
15:49:31,202 ERROR [STDERR] at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:968)
15:49:31,202 ERROR [STDERR] at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1643)
15:49:31,202 ERROR [STDERR] at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:
378)
15:49:31,202 ERROR [STDERR] at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127)
15:49:31,202 ERROR [STDERR] at org.springframework.faces.webflow.FlowViewHandler.renderView(FlowViewHandler.java:99)
15:49:31,202 ERROR [STDERR] at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:269)
15:49:31,202 ERROR [STDERR] at org.springframework.faces.webflow.FlowViewHandler.renderView(FlowViewHandler.java:99)
15:49:31,202 ERROR [STDERR] at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117)
15:49:31,202 ERROR [STDERR] at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
15:49:31,202 ERROR [STDERR] at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
15:49:31,202 ERROR [STDERR] at org.springframework.faces.webflow.FlowLifecycle.render(FlowLifecycle.java:80)
15:49:31,202 ERROR [STDERR] at org.springframework.faces.webflow.JsfView.render(JsfView.java:90)
15:49:31,202 ERROR [STDERR] at org.springframework.webflow.engine.ViewState.render(ViewState.java:296)
15:49:31,202 ERROR [STDERR] at org.springframework.webflow.engine.ViewState.resume(ViewState.java:207)
15:49:31,202 ERROR [STDERR] at org.springframework.webflow.engine.Flow.resume(Flow.java:545)
15:49:31,202 ERROR [STDERR] at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:261)
15:49:31,202 ERROR [STDERR] at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
15:49:31,202 ERROR [STDERR] at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
15:49:31,202 ERROR [STDERR] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
15:49:31,218 ERROR [STDERR] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
15:49:31,218 ERROR [STDERR] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
15:49:31,218 ERROR [STDERR] at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
15:49:31,218 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
15:49:31,218 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
15:49:31,218 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324)
15:49:31,218 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)
15:49:31,218 ERROR [STDERR] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88
)
15:49:31,218 ERROR [STDERR] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
15:49:31,218 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274)
15:49:31,218 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)
15:49:31,218 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
15:49:31,218 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
15:49:31,218 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181)
15:49:31,218 ERROR [STDERR] at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285)
15:49:31,218 ERROR [STDERR] at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261)
15:49:31,218 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88)
15:49:31,218 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValv
e.java:100)
15:49:31,218 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
15:49:31,218 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
15:49:31,218 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
15:49:31,218 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
15:49:31,218 ERROR [STDERR] at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheV
alve.java:53)
15:49:31,218 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
15:49:31,218 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
15:49:31,218 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654)
15:49:31,218 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
15:49:31,218 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
Rossen Stoyanchev (blog author) says:
Added on June 16th, 2011 at 11:55 amHi Murali, I can't really tell much by looking at the stack trace. I do see a RichFaces specific PartialViewContext class at the top invoking addAll() on an abstract collection, so I'd start by looking at the source code for that RichFaces class to see how that can come about.
On the Web Flow side it might help to know the render action is supported through the FlowPartialViewContext, which provides the renderIds based on the specified fragments. I would check to make sure Web Flow's PartialViewContext is being used.
Stephanie says:
Added on July 5th, 2011 at 8:09 pmHey! I visit your site regularly, but your blog doesn’t load on my Ipad. Could your firewall block my IP? Many thanks!
http://www.heelsvogue.com/ Christian Louboutin shoes
Lakshmipriya says:
Added on March 7th, 2012 at 4:52 amHi Rossen ,
I am trying to integrate spring webflow 2.0 with jquery 1.7.3. I have a main page in which a leftmenu (accordion menu) is dynamically created html using jQuery-ajax and json. In the js file i dont have tag instead of that i am having tag amd in the title i will be using some *.html . That is how am navigating to the corresponding page.
1)How can i proceed with webflow in this scenario ?
2)Is there any known issues related with integrating spring webflow and jQuery .Please reply .
Thanks
Lakshmipriya