2 Replies Latest reply on Oct 13, 2009 9:14 PM by vdeminico

    problem using @Factory

    vdeminico

      Hi,
      I have problem using @Factory and @DataModel annotations.
      I'd want to load a data list into a selectOneMenu widget. Action code is:



      @Name("regioneAction")
      public class RegioneAction {
           @In(create=true)
           RegioneService regioneService;
           
           @Logger
           Log logger;
           
           @DataModel(scope=ScopeType.PAGE)
           @Out(required=false)
           List<Regione> regioni=null;
                
           @Factory(value="regioni")
           public void retrieveAllRegioni()
           {
                logger.debug("Executing Factory method");
                regioni = regioneService.retrieveAllRegione();
           }
      
              public List<Regione> getRegioni()
           {
                return this.regioni;
           }
           
           public void setRegioni(List<Regione> reg)
           {
                this.regioni=reg;
           }
           }
      



      Instead the xhtml code is:



      <h:selectOneMenu id="regione" value="#{regione}" require="true">
                               <s:selectItems value="#{regioneAction.regioni}" var="reg" label="#{reg.nome}"/>
                               
      </h:selectOneMenu>
      




      The Factory method is never invoked and so the selectItems receives a null argument object for regioneAction.regioni.


      Which could be the solution?


      Thanks,
      Valerio.