[jboss-user] [JBoss Seam] - Re: @DataModelSelection defaults to first value in model??

ebu do-not-reply at jboss.com
Wed Mar 21 18:06:55 EDT 2007


Hi
I met the same problem,  but in slightly different context - i have a CRUD SFSL and it's instance member after creation was overwritten with new value:


  | public class ItemEditor implements ItemEditorLocal{
  |    @DataModelSelection
  |    private Item item = new Item();
  | ...
  | 
  |    public void persist() {
  |         em.persist(this.item);
  | 	 ....
  |         this.item = new Item();
  |    }
  | ...
  | }
  | 

by this i wanted to clean the form which displays current item. But instead i got my form populated with recently entered data. Even after killing all cookies and refreshing the page it was filled. I was completely baffled!

But it appears that most likely the problem is caused by javax.faces.model.ListDataModel - it sets rowIndex to 0 when it has some data and then when injectDataModelSelections is being called on a component the first element in a datamodel is picked up and injected into member annotated with @DataModelSelection... hardly it was expected behaviour...

btw, there is a astounding code in injectDataModelSelection:

  |          if (null!=null)
  |          {
  |             setFieldValue( bean, null, name, wrapper.getWrappedData(dataModelAnn, dataModel) ); //for PAGE scope datamodels (does not work for properties!)
  |          }
  | 

i mean null!=null ... what is that?

wbr, eugen.


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

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



More information about the jboss-user mailing list