Blogs

SpringSource Blog

Spring For JavaServerFaces – TSSJS Slides and Demos

Keith Donald

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:

  1. Use SVN to checkout https://springframework.svn.sourceforge.net/svnroot/springframework/spring-webflow/trunk.
  2. Access the build-spring-webflow directory and run ant. You'll need ant 1.7 to build.
  3. 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

Share this Post
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • DZone
  • LinkedIn
  • Slashdot
  • Technorati
  • TwitThis
 

16 responses


  1. Interesting, 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 :-)


  2. Hi,

    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


  3. Just 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


  4. Hallo,

    tried to run the demos and got the same message as Sergey.

    There is no subdirectory called "spring_build" in the repository.
    :-(


  5. spring-build is an svn external, you just get it on checkout of https://springframework.svn.sourceforge.net/svnroot/springframework/spring-webflow/trunk


  6. As 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).


  7. [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


  8. Build 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


  9. Alex,

    Look that test is failing because it is relying on the default Locale, but assuming a Locale of EN. Fixed, thanks.

    Keith


  10. When building the current svn checkout it seems to require Spring 2.5.3 which ivy cannot find. Should it be on the amazon repository?


  11. Kristof,

    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


  12. I 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?


  13. Hi,

    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?


  14. Hi,
    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


  15. Hello Keith,
    Absolutely amazing work. I did look at all the samples and they are simply brilliant.

    Do you also have a sample of integration of JSF Tiles and Spring MVC or even Spring MVC and JSF.

    Thanks in advance.


  16. hi , i want to run simple application of spring webflow and java server faces in netbean. i have tried my best but could not do it. i am very very very upset sue to it. if some one can help me in this regard by sending solution via email(saqib495@hotmail.com) or on this forum. thanks in advance. saqib mehmood.

Leave a Reply