title: How to pass/redirect/dispatch from a backing bean to a JSF page during response
body: <p>I have a web application which basically process entries of the user when the commandButton is hit, then receives a response/result message of the transaction and should be displayed in another JSF page.</p>
  
  <p>Here's a sample what I want  to do: I'm using JSF2 and primefaces</p>
  
  <p><em>registration.xhtml</em> - starting point for the transaction</p>
  
  <p><em>RegistrationBean</em> - backing bean used by registration.xhtml
    - has the "create" (also processes the data entered and supposedly sets up the ResultBean) method invoked via the commanButton on registration.xhtml then return string for navigation (to result.xhtml)</p>
  
  <p><em>result.xhtml</em> - result UI of the transaction</p>
  
  <p><em>ResultBean</em> - holds values needed by the result.xhtml</p>
  
  <p>I've been searching for samples over the internet and seem can't find one. Is there a way to accomplish this? And if none, maybe a workaround? I'm a beginner using this. Any help would be greatly appreciated. Thanks in advance!
  See below for sample code.</p>
  
  <p><strong>registration.xhtml:</strong></p>
  
  <pre><code>&lt;h:form style="position: absolute" id="basicPartyRegistration"&gt;
  &lt;h:panelGroup&gt;
      &lt;h:commandButton id="createButton1"  action="#{partyRegistration.create}" value="Create"&gt;
      &lt;/h:commandButton&gt;
      &lt;h:button outcome="welcome" value="Main Page" id="mainPageButton" /&gt;
  &lt;/h:panelGroup&gt;
  &lt;br /&gt;
  &lt;h:panelGroup&gt;
      &lt;p:panelGrid columns="2"&gt;
      &lt;h:outputText value="Receiver:" /&gt;
      &lt;h:inputText id="receiver"
          value="#{partyRegistration.partyRegistrationInfo.receiverGLN}"
          size="15" maxlength="13" /&gt;
      &lt;h:outputText value="TransmittingData:" /&gt;
      &lt;h:inputText id="transmittingDataPool"
          value="#{partyRegistration.partyRegistrationInfo.transmittingDataPool}"
          size="15" maxlength="13" /&gt;
      &lt;h:outputText value="PartyData:" /&gt;
      &lt;h:inputText id="partyData"
          value="#{partyRegistration.partyRegistrationInfo.partyDataPool}"
           size="15" maxlength="13" /&gt;
  &lt;/p:panelGrid&gt;
  
  .....
  .....
  </code></pre>
  
  <p><strong>RegistrationBean:</strong></p>
  
  <pre><code>@ManagedBean (name = "partyRegistration")
  @viewScoped //Changed to @ConversationScoped
  public class RegistrationBean implements Serializable{
      private String receiver
      private String transmittingData;
      private String partyDataPool;
      @ManagedProperty (value = "resultBean")
      private Result result;
      // more variables
      //public getters and setters
  
      public String create(){
         // do some processing
         // some magic way to set RESULT bean to be used in the next page
         return "result";
      }
  }
  </code></pre>
  
  <p><strong>result.xhtml</strong> </p>
  
  <pre><code>&lt;h:form style="position: absolute" id="partyRegistrationResponse"&gt;
  &lt;h:panelGroup&gt;
  &lt;h:button outcome="welcome" value="Main Page" id="mainPageButton" /&gt;
  &lt;/h:panelGroup&gt;
  &lt;br/&gt;
  &lt;h:panelGroup&gt;
  &lt;p:panelGrid columns="4"&gt;
      &lt;h:outputText value="Last Date Changed: " /&gt;
      &lt;p:inputText id="lastDateChg" value="#{partyResponse.lastChangedDateItem}"
          title="Last Date Changed" size="15" &gt;
      &lt;/p:inputText&gt;
  
  &lt;/p:panelGrid&gt;
  &lt;h4&gt;Response Identification&lt;/h4&gt;
  .....
  .....
  </code></pre>
  
  <p><strong>ResultBean:</strong></p>
  
  <pre><code>@ManagedBean (name = "partyResponse")
  @ViewScoped //changed to @ConversationScoped
  public Class ResultBean implements Serializable{
      private Date lastChangedDateItem;
      //more variables
      //getters and setters
  }
  </code></pre>
  
  <p><strong>faces-config.xml</strong></p>
  
  <pre><code>&lt;navigation-rule&gt;
      &lt;navigation-case&gt;
          &lt;from-outcome&gt;result&lt;/from-outcome&gt;
          &lt;to-view-id&gt;/result.xhtml&lt;/to-view-id&gt;
      &lt;/navigation-case&gt;
  &lt;/navigation-rule&gt;
  </code></pre>