Spring For JavaServerFaces – TSSJS Slides and Demos

Today I am delivering a presentation entitled Spring for Java Server Faces at TSSJS in Las Vegas. The presentation looks at how JSF and Spring fit together, and walks the audience through approaches to integrating these two technologies.
The slides are available for your viewing pleasure, and for you to use as you see fit.
In the presentation, I outline two approaches to integrating JSF and Spring. The first approach is what I call "JSF-centric", which is the integration approach most folks with a traditional JSF background employ today. The second approach is what I call "Spring-centric", which is a new, groundbreaking approach to JSF integration driven by the work done in the Web Flow 2 distribution.
There are two demos in this presentation, one showing an example of a "JSF-centric" Spring web application, and another showing a "Spring-centric" application that uses JSF as the UI component model. There is also a comparison of the two demos at the end of the presentation.
To review and run the demos mentioned in the slides:
- Use SVN to checkout https://springframework.svn.sourceforge.net/svnroot/springframework/spring-webflow/trunk.
- Access the build-spring-webflow directory and run ant. You'll need ant 1.7 to build.
- After the build completes, fire up Eclipse and import the spring-webflow-samples projects into your workspace. The booking-jsf project shows the "JSF-centric" approach. The swf-booking-faces project shows the "Spring-centric" approach.
Enjoy!
Similar Posts
- Slides and Demos from SpringOne Americas 2008
- Getting started with SpringSource dm Server
- Spring Dependency Injection & Java 5 (including slides and code)
- Java to JavaScript Compilation with AJAX and Spring Integration
- Configuration Simplifications in Spring 3.0











Graeme Rocher says:
Added on March 27th, 2008 at 7:01 pmInteresting, might be cool to use the spring-centric approach to create a Grails plug-in that lets you use JSF just for the view rendering part
Some Grails users have expressed a desire to use JSF for the view, seems like you've done the hard work for me again
Sergey says:
Added on March 28th, 2008 at 5:45 amHi,
seems to be 'spring-build' project is missing in SVN (or it's in some other repository ?)
build fails with error:
… can not find file '/../spring-build/multi-bundle/default.xml' imported from build-spring-webflow/build.xml
//sv
Thomas Spiegl says:
Added on March 28th, 2008 at 7:32 amJust took a look at swf-booking-faces, nice example – thanks!
To make swf-booking-faces.war run on tomcat6 I had to add WEB-INF/lib/cglib_nodep-2.1.3.jar and remove /WEB-INF/lib/el-api.jar
Sascha says:
Added on March 28th, 2008 at 8:09 amHallo,
tried to run the demos and got the same message as Sergey.
There is no subdirectory called "spring_build" in the repository.
Thomas Spiegl says:
Added on March 28th, 2008 at 8:24 amspring-build is an svn external, you just get it on checkout of https://springframework.svn.sourceforge.net/svnroot/springframework/spring-webflow/trunk
Keith Donald (blog author) says:
Added on March 28th, 2008 at 10:40 amAs Thomas mentioned, please make sure you checkout trunk as linked above. The spring-build system gets linked in as an svn external, so if you try to checkout the individual modules you will not get it.
Thomas, yes it appears there may be a few build issues with some third-party JARS in the WAR build. Thanks for posting what you had to do to get it to work. We will fix this (what we generally do is simply import the projects into Eclipse as Dynamic Web Projects and run them there with Tomcat inside Eclipse, and we have not yet tested standard WAR deployment extensively since migrating to the new spring-build system last week).
Ben Hale (blog author) says:
Added on March 28th, 2008 at 10:40 am[quote comment="101692"]Hi,
seems to be 'spring-build' project is missing in SVN (or it's in some other repository ?)
[/quote]
@Sergey and @Sacha, I'm not sure exactly how you're checking out the code, but you need to make sure that you checkout the *entire* trunk. If you're just checking out the individual directories you won't get spring-build. Thomas hits it right on the head with it being an svn:external on the trunk/ directory.
-Ben
Alex says:
Added on March 30th, 2008 at 5:49 amBuild failed with a failed test…
[junit] Testcase: testRenderWithBindingModel(org.springframework.webflow.mvc.view.MvcViewTests): FAILED
[junit] expected: but was:
[junit] junit.framework.AssertionFailedError: expected: but was:
[junit] at org.springframework.webflow.mvc.view.MvcViewTests.testRenderWithBindingModel(MvcViewTests.java:80)
[junit]
[junit]
[subant] Leaving directory: C:\Java\Projects\spring-webflow\spring-webflow
BUILD FAILED
C:\Java\Projects\spring-webflow\spring-build\multi-bundle\quality.xml:23: The following error occurred while executing this line:
C:\Java\Projects\spring-webflow\spring-build\multi-bundle\common.xml:70: The following error occurred while executing this line:
C:\Java\Projects\spring-webflow\spring-build\common\quality.xml:36: The following error occurred while executing this line:
C:\Java\Projects\spring-webflow\spring-build\common\quality.xml:162: Tests failed
Keith Donald (blog author) says:
Added on March 30th, 2008 at 10:00 amAlex,
Look that test is failing because it is relying on the default Locale, but assuming a Locale of EN. Fixed, thanks.
Keith
Kristof says:
Added on April 5th, 2008 at 3:59 pmWhen building the current svn checkout it seems to require Spring 2.5.3 which ivy cannot find. Should it be on the amazon repository?
Keith Donald (blog author) says:
Added on April 5th, 2008 at 4:52 pmKristof,
The release of Spring Framework 2.5.3 is imminent but it hasn't happened just yet — we are prepared for it once it does, already, as we have been tested internally against it.
Keith
Mike Sauer says:
Added on April 9th, 2008 at 6:36 amI really like what I see with Spring Web Flow and its integration with JSF. I am concerned, however, about the impact of Seam and the future Web Beans spec. Any info on comparing Spring Web Flow with JSF against Seam and plans to support the Web Beans spec?
Armin says:
Added on June 12th, 2008 at 5:03 amHi,
i really appreciate the spring philosophy providing the knowledge how to implement things with some examples.
Unfortunately, in the JSF centric example, there is no webflow included. In my project we use myfaces, and spring webflow behind the faces servlet and this works.
Is this way of connecting swf and myfaces not supported in swf 2 anymore?
John says:
Added on October 1st, 2009 at 1:54 pmHi,
I am trying your examples but with many missing libraries. Once i add libraries, they are compiled in Eclipse (3.3), but can not run on tomcat 6.0.16.
I am not sure why addeding IVY_CACHE class path variable not working.
B.T.W. i don't have maven built-in Eclipse.
Any idea?
Thanks