4 Replies Latest reply on Mar 17, 2006 11:03 PM by gavin.king

    pageflow problems again

    ido_tamir

      Hello,

      I am having again problems with pageflows.
      I don't know what I am doing wrong therefore I post full config files.
      The problem is simple: the pageflow immediately executes the first
      transition it finds, and dies at the second page. (seam is from todays cvs).
      thank you very much for suggestions
      sincerely
      ido

      <?xml version="1.0"?>
      
      <pageflow-definition name="testFlow">
       <start-state name="start">
       <transition to="one"></transition>
       </start-state>
      
       <page name="one" view-id="/one.jsf" redirect="true">
       <transition name="testA" to="two"></transition>
       <transition name="testB" to="end"></transition>
       </page>
      
       <page name="two" view-id="/two.jsf" redirect="true">
       <transition name="testA" to="end"></transition>
       <transition name="testB" to="end"></transition>
       </page>
      
       <page name="end" view-id="/end.jsf">
       <end-conversation/>
       </page>
      
      </pageflow-definition>
      



      <faces-config>
       <application>
       <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
       </application>
       <lifecycle>
       <phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
       </lifecycle>
      </faces-config>


      web.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      
       <listener>
       <listener-class>
       org.apache.myfaces.webapp.StartupServletContextListener
       </listener-class>
       </listener>
      
       <listener>
       <listener-class>
       org.jboss.seam.servlet.SeamListener
       </listener-class>
       </listener>
       <filter>
       <filter-name>Seam Exception Filter</filter-name>
       <filter-class>
       org.jboss.seam.servlet.SeamExceptionFilter
       </filter-class>
       </filter>
      
       <filter>
       <filter-name>Seam Redirect Filter</filter-name>
       <filter-class>
       org.jboss.seam.servlet.SeamRedirectFilter
       </filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>Seam Redirect Filter</filter-name>
       <url-pattern>*.jsf</url-pattern>
       </filter-mapping>
       <filter-mapping>
       <filter-name>Seam Exception Filter</filter-name>
       <url-pattern>*.jsf</url-pattern>
       </filter-mapping>
      
       <context-param>
       <param-name>org.jboss.seam.core.init.componentClasses</param-name>
       <param-value>org.jboss.seam.core.Jbpm</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.jboss.seam.core.jbpm.pageflowDefinitions</param-name>
       <param-value>pageflow.jpdl.xml</param-value>
       </context-param>
      
      
       <!-- 120 second conversation timeout -->
       <context-param>
       <param-name>
       org.jboss.seam.core.manager.conversationTimeout
       </param-name>
       <param-value>120000</param-value>
       </context-param>
      
       <!-- MyFaces -->
       <context-param>
       <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
       <param-value>false</param-value>
       </context-param>
      
      
       <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>client</param-value>
       </context-param>
      
       <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.xhtml</param-value>
       </context-param>
      
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.jsf</url-pattern>
       </servlet-mapping>
      
      </web-app>


      @Name("pf")
      @Stateful
      @Scope(ScopeType.CONVERSATION)
      @Interceptors(SeamInterceptor.class)
      //@Intercept(InterceptionType.ALWAYS)
      //@Conversational(ifNotBegunOutcome="start")
      public class PageFlowAction implements PageFlow {
       @Begin(join=false,pageflow="testFlow")
       public void begin() {}
       @Destroy @Remove
       public void destroy(){}
      }

      one and two are almost identical (header is different)
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:c="http://java.sun.com/jstl/core"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html">
      <head>
       <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
       <title>test</title>
      </head>
      <body id="body">
       <h1>One</h1>
       <h:form>
       <h:commandLink action="testA" value="a"/>
       <h:commandLink action="testB" value="b"/>
       </h:form>
      </body>
      </html>
      


      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:c="http://java.sun.com/jstl/core"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core">
      <head>
       <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
       <title>test</title>
      </head>
      <body id="body">
       <h1>start</h1>
       <h:form>
       <p><h:commandLink action="#{pf.begin}" value="start"/>
       <!--f:param name="conversationId" value="new"/-->
       </p>
       </h:form>
      </body>
      </html>
      


        • 1. Re: pageflow problems again
          ido_tamir

          I am pretty convinced that this is a seam problem.
          The following patch makes just three changes to the CVS version of
          the numberGuess example:


          1. removes @Create from numberGuess.begin()
          2. adds a start.jsp page that can activate numberGuess.begin()
          3. changes index.html to start with the start.jsp page


            The result is that after clicking start, the pageflow immediately
            executes numberGuess.guess resulting in an error.
            If I would have put a different transition in front, then
            it would have forwarded to the next page immediately.
            This patch however does not demonstrate if or why the pageflow
            is ending prematurely.

            best wishes
            ido


            
            Index: examples/numberguess/src/org/jboss/seam/example/numberguess/NumberGuess.java
            ===================================================================
            RCS file: /cvsroot/jboss/jboss-seam/examples/numberguess/src/org/jboss/seam/example/numberguess/NumberGuess.java,v
            retrieving revision 1.2
            diff -u -r1.2 NumberGuess.java
            --- examples/numberguess/src/org/jboss/seam/example/numberguess/NumberGuess.java 9 Jan 2006 05:21:22 -0000 1.2
            +++ examples/numberguess/src/org/jboss/seam/example/numberguess/NumberGuess.java 17 Mar 2006 18:09:40 -0000
            @@ -19,7 +19,7 @@
             private int guessCount;
             private int maxGuesses;
            
            - @Create
            +
             @Begin(pageflow="numberGuess")
             public void begin()
             {
            Index: examples/numberguess/view/index.html
            ===================================================================
            RCS file: /cvsroot/jboss/jboss-seam/examples/numberguess/view/index.html,v
            retrieving revision 1.1
            diff -u -r1.1 index.html
            --- examples/numberguess/view/index.html 19 Jan 2006 13:01:12 -0000 1.1
            +++ examples/numberguess/view/index.html 17 Mar 2006 18:09:40 -0000
            @@ -1,5 +1,5 @@
             <html>
             <head>
            - <meta http-equiv="Refresh" content="0; URL=numberGuess.seam">
            + <meta http-equiv="Refresh" content="0; URL=start.seam">
             </head>
             </html>
            \ No newline at end of file
            Index: examples/numberguess/view/start.jsp
            ===================================================================
            RCS file: examples/numberguess/view/start.jsp
            diff -N examples/numberguess/view/start.jsp
            --- /dev/null 1 Jan 1970 00:00:00 -0000
            +++ examples/numberguess/view/start.jsp 1 Jan 1970 00:00:00 -0000
            @@ -0,0 +1,15 @@
            +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
            +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
            +<html>
            +<head>
            +<title>test</title>
            +</head>
            +<body>
            +<h1>start</h1>
            +<f:view>
            + <h:form>
            + <h:commandLink action="#{numberGuess.begin}" value="start"/>
            + </h:form>
            +</f:view>
            +</body>
            +</html>
            


          • 2. Re: pageflow problems again
            gavin.king

            But this is correct behavior, right?

            The first transition out of the <start-state> is supposed to occur immediately the pageflow starts.

            • 3. Re: pageflow problems again
              gavin.king

              Ignore the last msg. I understand what you are saying now. Let me think this one through and I will get back to you.

              • 4. Re: pageflow problems again
                gavin.king

                I've treated this as a bug and fixed it in CVS.