[jboss-user] [JBoss Seam] - Re: DataModelSelection and Outjection confusion

gavin.king@jboss.com do-not-reply at jboss.com
Sun Oct 1 12:09:49 EDT 2006


I doubt that this is the problem, but note that the combination of @DataModel and @Observer on the same method is very, very wierd and probably nonsensical.

This makes more sense:

@Stateful
  | @Scope(SESSION)
  | @Name("dataSourceView")
  | @LoggedIn
  | public class DataSourceViewAction implements DataSourceView, Serializable
  | {
  |    ...   
  | 
  |    @In(scope=SESSION, required=true)
  |    private DataSource dataSource;
  |    
  |    @DataModelSelection(value="dataFields")
  |    @Out(scope=SESSION, required=false)
  |    private DataField dataField;
  | 
  |    @DataModel
  |    private List<DataField>dataFields;
  |    
  |    @Observer("selectDataSource")
  |    public void initDataFields()
  |    {
  |       log.info("in new getDataFields for #0", dataSource == null ? "null" : dataSource.getName());
  |       dataFields = dataSource.getDataFields();
  |    }
  |    
  |    public String selectDataField()
  |    {
  |       log.info("get dataField: #0", dataField.getName());
  |       return "dataviewer";
  |    }
  |    
  |    @Destroy @Remove
  |    public void destroy() {}
  |    
  | }


Ah hah! Now I see the problem: you raise the event from the method that actually initializes the value of the dataSource context variable, which means is has not yet been outjected at that point.

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

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



More information about the jboss-user mailing list