[jboss-user] [JBoss Seam] - Creating a simple selectOneMenu

felixk2 do-not-reply at jboss.com
Tue Jan 8 09:48:09 EST 2008


Hi,

I'm trying to use a selectOneMenu for a String property in an Entity. For example I have an entity with: 

@NotNull
  | @Column(name="Status")
  | @Length(max=16)
  | private String status;

Instead of using a textbox for users to fill in this field i'd like to use a drop down with values that I populate. So I created the following h:selectOneMenu:

<s:decorate template="layout/edit.xhtml">
  |   <ui:define name="label">Status</ui:define>
  |   <h:selectOneMenu value="#{customerHome.instance.status}">
  |     <f:selectItem itemLabel="Active" itemValue="Active"/>
  |     <f:selectItem itemLabel="Inactive" itemValue="Inactive"/>
  |   </h:selectOneMenu>
  | </s:decorate>

This works fine for submitting of the form. The selected itemValue will end up in the database. But when I want to view the data the proper selectItem is never selected. I know for example that #{customerHome.instance.status} contains the string "Inactive" but the form shows "Active".

Any ideas how to fix that?

Thanks,
Felix


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

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



More information about the jboss-user mailing list