6 Replies Latest reply on Sep 13, 2006 4:56 PM by Gavin King

    Pageflow executed before the model values are applied

    Andrew Bailey Newbie

      I am seeing a problem in that the pageflow seems to be executed before the model values are
      applied, is this a bug or is it a problem with my configuration.

      //the page is first requested
      14:03:23,365 INFO [DocumentRegisterEntryBean] Start called
      14:03:23,380 INFO [DocumentRegisterEntryBean] getType null
      14:03:23,402 INFO [DocumentRegisterEntryBean] getType null

      //the form is submitted, getType is called by the pageflow before the set method.
      14:03:27,340 INFO [DocumentRegisterEntryBean] getType null
      14:03:27,341 INFO [DocumentRegisterEntryBean] setType register
      14:03:27,342 ERROR [SeamExceptionFilter] uncaught exception handled by Seam
      javax.servlet.ServletException
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:156)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain
      ........
      Caused by: org.jbpm.JbpmException: decision expression '#{documentRegister.type}' returned null
      at org.jbpm.graph.node.Decision.execute(Decision.java:110)
      ... 46 more


      The form

      <h:form>
      <h:outputText value="#{messages.itIsA}"/>
      <h:selectOneRadio value="#{documentRegisterEntry.type}">
      <f:selectItem
      itemValue="document" itemLabel="#{messages.document}"/>
      <f:selectItem
      itemValue="register" itemLabel="#{messages.register}"/>
      </h:selectOneRadio>

      <h:commandButton action="next" value="#{messages.next}" />
      </h:form>

      The code

      @Scope(SESSION)
      @Name("documentRegisterEntry")
      public class DocumentRegisterEntryBean implements Serializable, DocumentRegisterEntry
      {

      private String type;

      @Logger
      private Log logger;

      @In(create=true)
      private Document document;

      @PersistenceContext()//type=EXTENDED)
      private EntityManager em;

      @Create
      //@Begin()
      @Begin(pageflow="documentRegisterEntry")
      public void start()
      {
      logger.info("Start called");
      }

      @End
      // @Transactional()
      public void save()
      {
      logger.info("Save called");
      }

      @Remove @Destroy
      public void destroy()
      {
      logger.info("Destroy called");
      }

      public Document getDocument()
      {
      logger.info("getDocument "+document);
      return document;
      }

      public void setDocument(Document document)
      {
      logger.info("setDocument "+document);
      this.document = document;
      }

      public String getType()
      {
      logger.info("getType "+type);
      return type;
      }

      public void setType(String type)
      {
      logger.info("setType "+type);
      this.type = type;
      }


      The pageflow

      <?xml version="1.0"?>

      <pageflow-definition name="documentRegisterEntry">
      <start-page name="type" view-id="/documentOrRegister.xhtml">


      </start-page>




      <!-- action is never triggered -->



      <page name="register" view-id="/register.xhtml">





      <page name="document" view-id="/document.xhtml">








      Thanks in advance
      Andy Bailey
      www.hazlorealidad.com

        • 1. Re: Pageflow executed before the model values are applied
          Andrew Bailey Newbie

          The pageflow didnt appear correctly trying again...

          <?xml version="1.0"?>

          <pageflow-definition name="documentRegisterEntry">
          <start-page name="type" view-id="/documentOrRegister.xhtml">


          </start-page>







          <page name="register" view-id="/register.xhtml">





          <page name="document" view-id="/document.xhtml">







          <page name="documents" view-id="/documents.xhtml">







          <page name="complete" view-id="/new_complete.xhtml">

          <end-conversation/>

          </pageflow-definition>

          • 2. Re: Pageflow executed before the model values are applied
            Andrew Bailey Newbie

            Disable htm didnt work either
            Using vi to replace less thans and greater thans with the character entities
            &lt;?xml version="1.0"?&gt;

            &lt;pageflow-definition name="documentRegisterEntry"&gt;
            &lt;start-page name="type" view-id="/documentOrRegister.xhtml"&gt;
            &lt;redirect/&gt;
            &lt;transition name="next" to="checkType" /&gt;
            &lt;/start-page&gt;

            &lt;decision name="checkType" expression="#{documentRegister.type}"&gt;
            &lt;transition name="document" to="document"/&gt;
            &lt;transition name="register" to="register"&gt;
            &lt;/transition&gt;
            &lt;/decision&gt;

            &lt;page name="register" view-id="/register.xhtml"&gt;
            &lt;redirect/&gt;
            &lt;transition name="prev" to="type"/&gt;
            &lt;transition name="next" to="documents"/&gt;
            &lt;/page&gt;

            &lt;page name="document" view-id="/document.xhtml"&gt;
            &lt;redirect/&gt;
            &lt;transition name="prev" to="type"/&gt;
            &lt;transition name="next" to="documents"&gt;
            &lt;action expression="#{documentRegister.save}"/&gt;
            &lt;/transition&gt;
            &lt;/page&gt;

            &lt;page name="documents" view-id="/documents.xhtml"&gt;
            &lt;redirect/&gt;
            &lt;transition name="prev" to="document"/&gt;
            &lt;transition name="next" to="complete"&gt;

            &lt;/transition&gt;
            &lt;/page&gt;

            &lt;page name="complete" view-id="/new_complete.xhtml"&gt;
            &lt;redirect/&gt;
            &lt;end-conversation/&gt;
            &lt;/page&gt;
            &lt;/pageflow-definition&gt;

            • 4. Re: Pageflow executed before the model values are applied
              Gavin King Master

              It is called documentRegisterEntry not documentRegister, fix your EL expression.

              • 5. Re: Pageflow executed before the model values are applied
                Andrew Bailey Newbie

                Thanks once again - my mistake

                I do think though that the message

                Caused by: org.jbpm.JbpmException: decision expression '#{documentRegister.type}' returned null
                at org.jbpm.graph.node.Decision.execute(Decision.java:110)

                is misleading, it would be better to say
                "documentRegister" not found in any context.

                Andy Bailey

                • 6. Re: Pageflow executed before the model values are applied
                  Gavin King Master

                  But jBPM (actually the Seam jBPM integration) delegates to JSF to evaluate the expression. And documentRegister.type has the perfectly legitimate value "null" in JSF-EL. So all we can do is report that the expression evaluated to null.