6 Replies Latest reply on Aug 23, 2007 12:24 PM by Andy Gibson

    How to correctly start pageflows

    Mikael Andersson Master


      I've been experimenting with pageflows a bit and different ways of starting them, prefferably I would like to start it in a way which doesn't require a backing bean method.

      This works for me:

      <s:link value="Start anno" action="#{dummyBacking.startPageFlowAnno}"/>
      public void startPageFlowAnno(){
       System.out.println("Trying to start the page flow via annotation.");

      But the following two doesn't (the first approach actually kills the webapp):

      <s:link value="Start comp params" action="#{dummyBacking.startPageFlow}" propagation="begin" pageflow="test"/>
      <s:link value="Start comp params" action="start" propagation="begin" pageflow="test"/>
      public String startPageFlow(){
       System.out.println("Trying to start the page flow via s:link parameters.");
       return "start";
      <s:link value="Manual PageFlow start in code" action="#{dummyBacking.manualStartFlow}"/>
      public String manualStartFlow() {
       return "start";

      The pageflow definition:

       "http://jboss.com/products/seam/pageflow http://jboss.com/products/seam/pageflow-2.0.xsd"
       <start-state name="start">
       <transition to="startPage">
       <action expression="#{dummyBacking.resetNumber}"/>
       <page view-id="/pageflow/start.xhtml" name="startPage" no-conversation-view-id="/pageflow/start.xhtml">
       <transition name="next" to="subPage1">
       <action expression="#{dummyBacking.incNumber}"/>
       <transition name="ManualStartFlow" to="subPage2"/>
       <page view-id="/pageflow/flow1.xhtml" name="subPage1" no-conversation-view-id="/pageflow/start.xhtml">
       <transition name="next" to="subPage2">
       <action expression="#{dummyBacking.incNumber}"/>
       <transition name="prev" to="startPage"/>
       <page view-id="/pageflow/flow2.xhtml" name="subPage2" no-conversation-view-id="/pageflow/start.xhtml">
       <transition name="next" to="endPage"/>
       <transition name="prev" to="subPage1"/>
       <page view-id="/pageflow/end.xhtml" name="endPage" no-conversation-view-id="/pageflow/start.xhtml">
       <transition name="prev" to="subPage2"/>

        • 1. Re: How to correctly start pageflows
          Mikael Andersson Master

          Perhaps it is realted to that other post about infinte loop?

          I get this message from firefos:

          Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

          • 3. Re: How to correctly start pageflows
            Pete Muir Master

            All the ones that don't work you need to use start-page rather than start-state. The exception does say this.

            • 4. Re: How to correctly start pageflows
              Przemyslaw Jaskierski Newbie

              Just for the records: there are plenty of pageflows containing start-state in Seam examples. This can make people think that it is a right way of doing things. Dvdstore, numberguess, todo.

              • 5. Re: How to correctly start pageflows
                Pete Muir Master

                The differences between start-state and start-page are explained (perhaps not clearly?) in the docs. Both are valid ways of starting a pageflow depending on where you are. And the exception is very helpful:

                (note that pageflows that begin during the RENDER_RESPONSE phase should use <start-page> instead of <start-state>)

                If you think this can be more clearly in the docs, it would be great if you can provide some more/better text

                • 6. Re: How to correctly start pageflows
                  Andy Gibson Novice

                  The fact that there needs to be two separate ways of defining the start page, and are both mutually exclusive is a bit of a pain. It forces you to choose a method that you will be using to start pageflows (either in the link, or in the @begin annotation) unless you want to start maintaining two separate versions of the pageflow, one with start-state and the other with start-page.

                  Personally, I never use @Begin annotations, I always start conversations in pages.xml (mostly based on Pete Muirs comments from a year ago). Which is odd because it seems like 99% of Seam users go for the @Begin annotation. I find using pages.xml for conversation management lets you create more RESTful style URLs, and lets you decouple your app a bit more. I also never use things like <s:link action="WidgetBean.editWidget(v_widget)"/> on the basis that it also clutters up the url.

                  If you need to call methods to edit the widget, there's no way to create a URL the user can enter to edit or view the widget, except maybe writing a wrapper page that they can enter the URL for, which calls editWidget and redirects, but then, how do they get the URL since it never appears to them in the address bar for them to copy/bookmark.

                  Also, you don't have to use the datamodel and data model selection business since you grab the id once for the URL, and don't need it again letting you introduce a little more statelessness into the app.

                  I've been meaning to ask for a while why everyone was using @Begin annotations in case there's some mystical magical reason that I wasn't aware of. I know it's nice calling bean methods and passing objects around instead of string IDs, but it just feels wrong to me.