[jboss-user] [JBoss Seam] - Multi-role components

awheeler do-not-reply at jboss.com
Tue Mar 27 20:13:42 EDT 2007

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 ?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032264#4032264

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032264

More information about the jboss-user mailing list