9 Replies Latest reply on Apr 2, 2008 12:12 AM by Phil Haigh

    Factory not working correctly following action with view-id

    Phil Haigh Novice

      This appears to be a recent problem (in either Seam 2.0 or 2.0.1)


      We have always used a simple factory method on a DAO to reference a component name in shorthand:


      @Factory("webpage")
      @Transactional
      public TextPage initTextPage() { return getInstance(); }                
      
      protected TextPage createInstance()
      {
              TextPage a = new TextPage();
              return a;
      }




      Referenced as:



      <h:outputText value="#{webpage.text}" escape="false"/>



      Id's are generally set using pages.xml:


      <page view-id="/charities/marketing_ebrochure_selectpages.xhtml" action="#{webpageDAO.setId(110)}"/>




      However, this recently stopped working reliably. It appears to be a problem triggered when using a commandbutton/link that calls a view-id directly as the action rather than a method. Even if the comonent ID is set on the receiving view -id page (and this can be verified by logging the ID setting method), the page shows the OLD component. The work around is to change the page as below (bypassing the factory):


      <h:outputText value="#{webpageDAO.instance.text}" escape="false"/>



      Any ideas?


      cheers


      phil