InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Spring Web Flow Enhances JSF Navigation and State

Posted by Scott Delap on Apr 25, 2007

Sections
Development
Topics
Java ,
Web Frameworks
Tags
Spring Web Flow
A long standing complaint with Java Server Faces is the navigation support. Ignacio Coloma documented his frustrations last fall:

...The start was simple: the component/renderer/validator/converter model is clean and easy to get up and running. The validation model works like a charm, JSP pages are quite minimal and you can get a working skeleton of your application in a snap. Then the hell of linking pages together starts...

Noted web application developer Matt Raible commented on JSF last week as well:

...If you're going to use JSF, I highly recommend Facelets or Shale/Seam ... There's two problems with Shale and Facelets - the activity on these projects is very low. Shale still has its creators around, so even while its seldom used, you can probably still get your questions answered. However, Facelets seems to be suffering from "developer abandonment".

Conclusion: don't use JSF simply because it's a "standard". Use other frameworks that are more actively developed and designed for the web. For component-based frameworks, the most popular are Tapestry and Wicket. Less popular ones are RIFE and Click. If you still want to use JSF, you should probably use Seam, but don't simply use JSF because it's a standard...

Companies are actively working to fix and enhance JSF however with JBoss' Seam being based on JSF and Spring Web Flow providing JSF support. Recently Interface21's Keith Donald detailed how Spring Web Flow integrates with JSF to provide a better model for implementing navigation logic and managing application state:

    As a JSF extension Spring Web Flow takes over navigation rules and managing the state associated with user interactions (a.k.a conversations). JSF developers benefit from enhanced navigation model. In summary Web Flow adds:

    • The ability to implement dynamic navigation rules that are changeable on-the-fly without a server restart
    • Full forward, backward, refresh, redirect, and recursive navigation capabilities built into its flow definition language
    • Modularization and encapsulation of navigation logic through the flow definition concept

    In respect to state management Web Flow adds conversation, flash, and flow state in addition to JSF's standard request, session and application.

Commenting on Donald's article Matt Raible remarks:

...I think it's interesting to note that both Interface21 and JBoss are doing a lot to build solutions to JSF's problems. Is there money to be made from supporting JSF? In reality, you have to like what both companies are doing: they're building solutions to overcome the shortcomings of JSF and they're contributing those solutions back to the community for free. Even cooler is the fact that both companies are trying to get their solutions into the next version of JSF. This benefits everyone as far as I'm concerned...
Nice! by Alexandre Poitras Posted
suboptimal at best by Eelco Hillenius Posted
Re: suboptimal at best by Jesse Kuhnert Posted
Re: suboptimal at best by Eelco Hillenius Posted
Re: suboptimal at best by Alexandre Poitras Posted
Re: suboptimal at best by Eelco Hillenius Posted
Re: suboptimal at best by Eelco Hillenius Posted
  1. Back to top

    Nice!

    by Alexandre Poitras

    Spring Web Flow seems like a very nice technology indeed. From what I've seen, it adds a fourth layer to your application, an application layer according to Fowler, standing between the presentation layer and the business layer. This layer becomes very useful when you have a quite complex UI, search forms coming to mind, and want to think of your application in terms of stateful sequences of actions and pages and not care about state handling.

    I may be crazy but I'm happy that this stuff doesn't come bundled in JSF and I don't see the basic JSF navigation model as a flaw. IMO, a more complex navigation model should be the responsibility of an application controller implemented as an indenpendent layer to make it usable from any web framework. For instance, I like the fact that SWF can *potentially* be integrated in any web framework out there. Plus, it's not everybody who needs this kinds of features. It might be overkill in a lot of cases. I can't wait to try this out more extensively but I have to convince the managing team first *sight*.

  2. Back to top

    suboptimal at best

    by Eelco Hillenius

    It is great that so much effort still goes into trying to fix some of the rough edges of JSF. However, I believe that the concept of externalized navigation is a mistake for anything other than real workflow (BPM) driven applications. Imho, any improvement will be suboptimal at best.

  3. Back to top

    Re: suboptimal at best

    by Jesse Kuhnert

    That is a curious comment to leave Eelco. Why would it surprise you to see the same people - that have probably created the largest positive impact on java enterprise development since well...java - continue to work around the same problems that their innovations were created to work around to begin with? (Speaking of IoC via Spring && whatever Hibernate is supposed to be called nowadays of course)

    I guess I've been guilty of being this way in the past but I've grown up some since then and can see that they are just people trying to make other peoples lives better by dropping their academic hangups and just solving the problems at hand. Sometimes some of you wicket devs appear to be operating in a context so far removed from reality - wrt your skills vs. that of the people you share your opinions with - that I am compelled to feel embarrassed for you.

    Well here's a useless comment opinion for you. Instead of doing all the gabbing and comment posts as you do so well - why don't you create your own headlines from some of your own technical achievements? How would that be for you eh? You'll probably not be able to see past your anger in my comments to find the truth but I hope you do.

  4. Back to top

    Re: suboptimal at best

    by Alexandre Poitras

    It is great that so much effort still goes into trying to fix some of the rough edges of JSF. However, I believe that the concept of externalized navigation is a mistake for anything other than real workflow (BPM) driven applications. Imho, any improvement will be suboptimal at best.


    I'm not following you on the fact that flow is like thinking in a procedural way. We are not talking about programming here and implementation but domain concepts, the domain being navigation. When you think about navigation, how do you think about it naturally. Personnaly it's not far from a flow.

  5. Back to top

    Re: suboptimal at best

    by Eelco Hillenius

    Helpful as ever Jesse.

  6. Back to top

    Re: suboptimal at best

    by Eelco Hillenius

    Alexandre,

    Imho, if you are solving a workflow problem, and let your application design reflect that, the workflow drives the UI, in which case externalized flow might be a good idea. If you follow that approach, I believe the workflow engine should be in charge all the way, and an intermediate layer (SWF?) should just be there as a translator between the workflow layer and UI.

    But how many people are actually creating applications that are centered around workflow? I think most applications build today (please feel free to slap me with some hard data if you find that) primairy have a domain centric design. The UI in such applications mainly exist to expose the domain model, and workflow is typically baked in in the domain model and limited to some very specific cases.

    Like I state in my blog, I believe externalized flow in such applications is a bad idea. It's another driver for sticking people to a documented oriented conception of applications. If you are truly working with pages that represent one function, and from each function there is a clear path to the next page representing another function, then fine, consider my remarks redundant. I just don't think that's the case often, and I believe that stressing flow as a major conceptual part of a framework puts people in the wrong mind set.

  7. Back to top

    Re: suboptimal at best

    by Eelco Hillenius

    When you think about navigation, how do you think about it naturally. Personnaly it's not far from a flow.


    I think a natural way of thinking about navigation is not to think in page based flows. Take any desktop application; whether buttons pop up a panel, replace part of the window or maybe the window altogether, 'flow' is much more localized compared to how people view web applications. But imho, there is no compelling reason for that, other than that the document oriented beginnings of the web.

Educational Content

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.