[jboss-user] [JBoss Seam] - Multiple roles and accessing the DataModel

zzzz8 do-not-reply at jboss.com
Sun Sep 10 04:23:58 EDT 2006


I'd like access a JSF DataModel from my JSP using EL.  Normally, this is a very easy thing to when one doesn't use multiple roles.  But in this case, I'm assigning multiple roles to a component and I can't seem to figure out the correct syntax for accessing the DataModel.

For example, here's a snippet of my source code:

@Name("component1")
  | @Role(name="component2")
  | @Stateful
  | public class Test implements TestLocal {
  |    @DataModel
  |    List<Item> list;
  | 
  |    @DataModelSelection
  |    Item item;
  | }

What is the correct EL for accessing the DataModel list associated with the component1 role and the component2 role?

I've tried:

#{component1.list}
  | #{component2.list}

However, when I do this, I don't seem to be getting the DataModel, but rather the actual List itself.  This is evidenced by the fact that a method in the class that uses the DataModelSelection is always stuck at pointing to the first item in the List list...

I've also tried modifying the source code to annotate with DataModel on the getter method:

List<Item> list;
  | 
  | @DataModel
  | public List<Item> getList() {
  |     return list;
  | }

Also, is there a bug with using the DataModelSelection and DataModelSelectionIndex annotations in the same class?

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

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



More information about the jboss-user mailing list