[jboss-user] [JBoss Seam] - Using @DataModel and @DataModelSelection in different Sessio

barfoos do-not-reply at jboss.com
Wed Sep 5 04:54:05 EDT 2007


Hi,

I want to separate DataProviding and EventHandling in my application
as much as possible. That's why I'm thinking of using one SessionBean
to provide DataModel for my facelets. Actions, that later will be triggered
from within the facelet by user events, should then be handeled in some
other session bean. I had two ideas on how to implement this, but none
succeeded. Could someone point me into the right direction?

Idea1:


  | @Stateful
  | public class DataProviderBean implements IDataProviderBean{
  | 
  |   @DataModel("entities")
  |   List<Entity> e;
  | 
  |   @Factory("e")
  |   public void initE(){ ... }
  | }
  | 
  | @Stateful
  | @Name("EventHandler")
  | public class EventHandler implements IEventHandler{
  |   @DataModelSelection(value="entities")
  |   Entity e;
  | 
  |   public event1(){
  |      // do some reasonable thing with e
  |   }
  | }
  | 

This unfortunatelly does not even deploy, since seam tells me,
that it needs a @DataModel for each @DataModelSelection
within EventHandler.

My second idea was as follows:


  | @Stateful
  | public class DataProviderBean implements IDataProviderBean{
  | 
  |   @DataModel("entities")
  |   List<Entity> e;
  | 
  |   @DataModelSelection(value="entities")
  |   @Out("selectedEntity")
  |   Entity e;
  | 
  | 
  |   @Factory("e")
  |   public void initE(){ ... }
  | }
  | 
  | @Stateful
  | @Name("EventHandler")
  | public class EventHandler implements IEventHandler{
  |   @In("selectedEntity")
  |   Entity e;
  | 
  |   public event1(){
  |      // do some reasonable thing with e
  |   }
  | }
  | 
  | 

But EventHandler.e did never get initialized with anything else than null.

Any ideas?

thanks and greetings
  barfoos

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

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



More information about the jboss-user mailing list