2 Replies Latest reply on May 22, 2008 10:13 PM by infinity2heaven

    How to reset SFSB in conversation mode, after a redirect

    infinity2heaven

      I have a search toolbar, clicking on which results appear (richfaces ajax) below, in a form. User can modify and click on save. Now, after returning results successfully, user might change criteria and save again. This time, no results are found. I'm setting a flag in SFSB and redirecting to the same page in pages.xml. However, the previous search results still remains. I have the entire flow Search, Add, Save, Cancel in a conversation as user can search/save multiple times on the same screen.


      SFSB



      @Out
      boolean noResults = false;
      
      @In(required=false) @Out(required=false)
      private FofPerformanceDetail fofPerformanceDetail;
      
      @Begin(join=true) // have to join conversation as search can be called multiple times
      public void search() {               
           try {
                fofPerformanceDetail = (FofPerformanceDetail) entityManager.createQuery("select fpd from FofPerformanceDetail fpd where " +
                     "fpd.fofPerformance.performance.fof.id =?1 and fpd.fofPerformance.timePeriod =?2")         
                .setParameter(1,selectedFof.getId())
                .setParameter(2, selectedTimePeriod)
                .getSingleResult();     
           }
           catch(NoResultException e) {
                log.info("Search Results did not fetch any Fof Performance");
                noResults=true;
           }
      }
      
      public void Save () {
      
      }
      
      @End
      public void Cancel {
      
      }



      fofPerformanceDetail is the entity that gets displayed in the xhtml (simple text fields)


      pages.xml


      <page view-id="/manageFofPerformance.xhtml">        
        <navigation from-action="#{manageFofPerformance.cancel}">
             <redirect view-id="/home.xhtml"/>
        </navigation>     
        <navigation from-action="#{manageFofPerformance.search}">
        <rule if="#{noResults}">
             <redirect view-id="/manageFofPerformance.xhtml">
                  <message severity="WARN">
                     No Results found. Please refine your search criteria
                  </message>
             </redirect>
         </rule>         
        </navigation>   
      </page>



      Pl suggest