3 Replies Latest reply on Sep 16, 2011 5:28 AM by jano480

    Conversation lost on redirect

    kramedt.darren.kramer.jackson.com
      I have  a simple application in which I am trying to use JSF 2.0 with CDI and follow a PRG pattern.  So on my main form, I have a simple command button that does nothing but start the current conversation:


      <h:commandButton id="continueButton" action="#registrationBean.startConversation}" value="Continue..." />


              public String startConversation() {
                      if (conversation.isTransient()) {
                              conversation.begin();
                      }
                      return "confirm";
              }


      Theoretically that should turn my current transient conversation into a long running one.  Then I have it redirect to a confirmation page:

      <navigation-rule>
          <from-view-id>/register.xhtml</from-view-id>
          <navigation-case>
            <from-outcome>confirm</from-outcome>
            <to-view-id>/registerConfirm.xhtml</to-view-id>
              <redirect/>
          </navigation-case>
        </navigation-rule>

      When I do this, I get the following exception:
      org.jboss.weld.context.NonexistentConversationException: WELD-000321 No conversation found to restore for id 1
              at org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:112)
              at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:88)
              at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)

      If I remove the <redirect/> tag from faces-config, then everything works fine, but then I am not following the PRG pattern.

      Is this a bug in Weld?  For some reason the conversation that I began before the redirect is somehow lost.