0 Replies Latest reply on Mar 27, 2007 8:13 PM by awheeler

    Multi-role components

    awheeler

      I have a backing bean which is used in both the session and conversation context as follows:

      @Name("searchCompany")
      @Scope(ScopeType.SESSION)
      @Roles( {@Role(name="findCompany",scope=ScopeType.CONVERSATION)} )
      


      In order for the outjected datamodel list to pick up the correct value on the page I have to use the page scope for the datamodel:

      @DataModel(value="companyList",scope=ScopeType.PAGE)
      public List<Company> getResultList() {
       return super.getResultList();
      }
      


      If I do not limit the scope to page then if a I use the bean in a convesation and a previously instantiated session bean exists then the page (in a conversation) uses the session datamodel before a search has occured. Clicking on the list results in an error as the list was not generated by the conversation bean.

      So it appears that I've solved my problem, but I can no longer use expressions such as the following in a dataTable:

      <s:link view="/secure/crm/editCompany.seam" action="#{editCompany.setInstance(company)}">
       #{company.companyName}
      </s:link>
      


      I guess this is because the datamodel doesn't have "sufficient" scope at the time of the action, or perhaps seam doesn't look in the page scope when doing action events.

      This problem is different from datamodelselection, which works for page scoped datamodel that postback to the same bean as the datamodel.

      Is this just a fact of life with seam, or is there a better way ?