1 Reply Latest reply on May 10, 2006 1:11 PM by Jason Long

      @DataModel(scope = ScopeType.PAGE) and @Factory problem

    Jason Long Master

      I have a DataModel and regular variable that are both Maps which I am populating as follows:

      Note there are 2 factory methods one to populate the DataModel and one for the total.

       @SuppressWarnings("unused")
       @DataModel(scope = ScopeType.PAGE)
       private List couplingMainList;
       @DataModelSelection
       private Map m;
      
       @SuppressWarnings("unused")
       @Out(scope = ScopeType.PAGE)
       private Map couplingMainListTotal;
      
      
       //This is for Excel style AutoFilter
       @In(required = false)
       @Out(scope = ScopeType.SESSION, required = false)
       private MainListCouplingFilter mainListCouplingFilter;
      
       @Begin
       public String receive()
       {
       setup();
       return "receiveCouplings";
       }
      
      
       @Factory("couplingMainList")
       public void summary()
       {
       System.out.println("@Factory(couplingMainList)");
       couplingMainList = couplingDAO.getMainListFiltered(mainListCouplingFilter);
       }
      
       @Factory("couplingMainListTotal")
       public void total()
       {
       System.out.println("@Factory(couplingMainListTotal)");
       couplingMainListTotal = couplingDAO.getMainListFilteredTotal(mainListCouplingFilter);
       }
      
      


      The receive method is called which starts a conversation and sent to a page for user input. After the proper data has been entered I end the Conversation and send the user back to the main page.

      The total factory is being called, but the one thta populates is not. Refreshing the page calls both and load the page properly.

      Both are called if just navigating to the page.

      This is how I am calling the factories in JSF.

       <t:dataTable id="data"
       rows="20"
       var="couplingSummary"
       value="#{couplingMainList}"
       rendered="true"
       styleClass="f_table"
       rowClasses="tr0,tr1"
      
      ...
      
      <h:outputText value="#{couplingMainListTotal['sumPieces']}">
      
      


      Is this a problem with the way I am using Seam?
      A conflict with the scope using <t:dataTable>?

      I figured since the scope of the DataModel was PAGE that is would be reloaded every time the page was requested like the total.

      Any help would be greatly appreciated?

        • 1. Re:   @DataModel(scope = ScopeType.PAGE) and @Factory proble
          Jason Long Master

          I solved the problem by using a get method on my bean instead of the factory to load the data table.

          I guess I am confused in the difference between

          http://fakedomain.com/coupling/mainList.xhtml
          


          and returning "couplingMainList" from a method.


           <navigation-case>
           <from-outcome>couplingMainList</from-outcome>
           <to-view-id>/coupling/mainList.xhtml</to-view-id>
           <redirect />
           </navigation-case>
          
          


          Could someone please clarify?