Results 1 to 4 of 4

Thread: Advice: webflow plus bookmarkable "non flow" pages (JSF/Facelets)

  1. #1
    Join Date
    Jun 2006
    Posts
    6

    Default Advice: webflow plus bookmarkable "non flow" pages (JSF/Facelets)

    We are starting a new project and are seriously considering using Webflow. Given our past experience with Seam, Richfaces and Facelets, we intend to use JSF/Facelets and not SpringMVC/JSP.

    While the Webflow 2.0 docs say that Webflow is intended to mix in with other view technologies -- where webflow coexists with other traditional controllers, I can't find a app that shows this sort of thing. The booking-faces is "all webflow" -- only the intro.xhtml page is outside a flow and it has no interaction with any backing beans. The corresponding jsf-booking example is all "raw jsf" without any corresponding webflow.

    We very much like the idea of using webflow's simplified XML based flow controller configuration and its state and navigation management. However, the webflow controller does not appear to be appropriate for single-page, non-flow based views -- at least not when we want to keep those single pages "bookmarkable", as many pages in our app will need to be (e.g., a search results report, status page, event details, etc.).

    We've experimented with using webflow as the controller for these pages and using URLRewrite to allow bookmarkable access. This works in one direction, but we can't get it to work in the other: For example even if we use URLRewrite to map

    /myapp/event/33
    to
    /myapp/spring/event?id=33

    (and then map the flow var id from flashScope.id), we can't find a way to use the URLRewrite <outbound-rule> to keep the user-visible URL bookmarkable -- it changes to

    /myapp/spring/event?execution=c2v1

    the event id has been moved into flow scope, and is no longer visible on the URL, so I can't extract it and hide the "flow execution" state from the user.

    I anticipate the answer will be that you do not recommend using the webflow controller for these sorts of pages. But I think that means that we will have to split our navigation rules and controller/validation logic between two different technologies (in a myflow.xml for multi-page flows, in faces-config.xml and various spring or JSF backing beans for single page bookmarkable pages). Seems ugly, error prone, and difficult to train new programmers. Hence my banging of head against wall to try to use the "cleaner" webflow controller for both types of pages...

    Can anyone point me at an example application that mixes both JSF webflow and simple bookmarkable pages?
    Last edited by tynor; Apr 27th, 2008 at 02:17 PM. Reason: typo in example urls

  2. #2
    Join Date
    Apr 2005
    Location
    San Francisco, CA
    Posts
    1,224

    Default

    There are a few options here. For certain pages, where you might not need to use JSF to process the postback (pages that are essentially completely stateless) you have the option of using the Spring MVC JsfView as we have done in the intro page in the sample. You could potentially use MVC controllers (including the new @Controller style) with such pages.

    On the other hand, if you want JSF to process the postback, you can use Web Flow as you are trying to do, and as I do generally recommend. What I would suggest is configuring two separate flow executors...one for handling bookmarkable single-view flows, and one for handling multi-page flows. You could then disable alwaysRedirectOnPause for the executor that manages the bookmarkable flows as follows:

    Code:
    <webflow:flow-executor id="bookMarkableFlowExecutor" flow-registry="flowRegistry">
       <webflow:flow-execution-attributes>
           <webflow:always-redirect-on-pause value="false"/>
       </webflow:flow-execution-attributes>
       ...
    </webflow:flow-executor>
    This will allow you to enter those particular flows without redirecting and thus without the url being re-written with the flow execution key. Plus you will still have all the benefits of using Web Flow to handle page events and you will be able to make use of view scope with no problem. Of course, if you handle in-page events (events that do not transition to another view-state) with a normal request, the flow execution key will appear in the new URL when the page is re-rendered, but you could certainly make use of the Ajax features for handling these in-page events, that way the URL stays completely bookmarkable for as long as you are in the same view.

    Making it easier to have both RESTful pages and stateful flows easily mixed within the same definition language is a big part of our future roadmap, but I think you can have good success in the present with this mixture of single-view and multi-view flows. We have several customers (including Orbitz, who talked about their positive experiences in detail at TSE in December) building large high-traffic web sites with a similar approach.
    Jeremy Grelle

    Staff Engineer, Web Products Team
    SpringSource

  3. #3

    Smile

    Is this technique working for SWF 2.0?

  4. #4

    Smile

    In our example no transitions are working after this configuration!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •