SelectItems are a pain in that they are a model that does not store selected state. The Seam DataBinding framework was designed for binding and selecting of model objects that do store extra selected state, like DataModel.
If you want to go the easiest route you can simply not have a DataSelector for your SelectItems. Simply use the <h:selectOneMenu/> value attribute and couple this to a property on your controller. Where selector is the controller and items are the bijected SelectItems list. | <h:selectOneListbox size="10" value="#{selector.selected}"> | <f:selectItems value="#{items}"/> | </h:selectOneListbox> | | private String selected = "Mark"; | | public String getSelected() | { | return selected; | } | | public void setSelected(String selected) | { | this.selected = selected; | } | | @SelectItems(valueStrategy=SelectItems.Strategy.STRING) | public List items; | | @Factory("items") | public List getItems() | { | items = new ArrayList(); | items.add("Jim"); | items.add("Dan"); | items.add("Mark"); | ArrayList<String> subgroup = new ArrayList<String>(); | subgroup.add("Other Developers"); | subgroup.add("Steve"); | subgroup.add("Ananda"); | items.add(subgroup); | return items; | } | To answer your question about the selector firing. Unless something is returned from DataBinder.getSelection() your selector won't fire. And since <h:selectOneMenu/> doesn't set the selected state on your #items, it's hard to do anything with the getSelection() method. I've been happy with the solution above, however if you really needed SelectItemsSelection support like DataModelSelection, then instead of a DataSelector, I'd write another DataBinder for your <h:selectOneMenu/> value object. Add a 'for' attribute to your SelectItemsSelection annotation so that you can get to it later. Then within your SelectItemsSelectionBinder's wrap/getWrappedData methods, do a lookup for your scoped SelectItems component and do the translation based on whatever value strategy you're using for your SelectItems (might need to include valueStrategy attribute in your SelectItemsSelection annotation). This might be a fun project for the weekend. If I get to it I'll try and post my solution. Hope this helps. -Jim View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3952874#3952874 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3952874 Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user