I've got a PAGE scope DataModel which was working fine until I added an 
inputText tag to the page.  Now the selection is always the first one on the 
list.    I know I've had some trouble understanding exactly how DataModels (and 
Seam in general, really) works, so I thought I'd post this here to see if 
someone can educate me before I declare that there's a bug.

I've boiled my code down to isolate the problem.  I have this bean:

  | @Stateful
  | @Scope(ScopeType.SESSION)
  | @Name("foo")
  | public class FooBean implements Serializable, Foo
  | {
  |     static final long serialVersionUID = -6536629890251170098L;
  | 
  |     private static Log log = LogFactory.getLog(FooBean.class);
  | 
  |     public FooBean()
  |     {
  |     }
  | 
  |     private String text;
  |     public String getText()
  |     {
  |     return text;
  |     }
  |     public void setText(String text)
  |     {
  |     this.text = text;
  |     }
  | 
  |     @DataModel(scope=ScopeType.PAGE)
  |     List<String> names;
  |     @DataModelSelection
  |     private String selectedName;
  | 
  |     public String dummy()
  |     {
  |     log.debug("Selected name is " + selectedName);
  |     return null;
  |     }
  | 
  |     @Factory("names")
  |     public void refresh() {
  |     names = new LinkedList<String>();
  |     names.add("Fred");
  |     names.add("Wilma");
  |     names.add("Barney");
  |     names.add("Betty");
  |     }
  | 
  |     @Destroy 
  |     @Remove
  |     public void destroy()
  |     {
  |     }
  | }
  | 

and this page:


  |   <body>
  |       <h:form>
  | <!--        <h:inputText value="#{foo.text}"/> -->
  |     <h:dataTable value="#{names}" var="name">
  |       <h:column>
  |         <f:facet name="header">
  |           <h:outputText value="Name" />
  |         </f:facet>
  |         <h:outputText value="#{name}" />
  |       </h:column>                        
  | 
  |       <h:column>
  |         <f:facet name="header">
  |           <h:outputText value="Action"/>
  |         </f:facet>
  |         <h:commandButton action="#{foo.dummy}" value="Test"/>
  |       </h:column>
  |     </h:dataTable>
  |       </h:form>
  |   </body>
  | 


It works fine unless I un-comment the inputText field, in which case the 
dummy() method always reports that I selected the first name.

What am I doing wrong?

Thanks,

Joe


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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3972370
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to