1 Reply Latest reply on Jul 2, 2007 6:30 AM by Pete Muir

    option values generated by s:selectItems

    Chris Malan Novice

      The following html is generated:

      <option value="0">admin</option>
      <option value="1">manager</option>
      <option value="2">user</option>


      It should be this:
      <option value="admin">admin</option>
      <option value="manager">manager</option>
      <option value="user">user</option>


      This comes from the Role class which has an @Id annotation for the primary key, which is a String.

      The code that produces the selectOneMenu looks like this:
      <h:selectOneMenu value="#{role.name}" required="true" id="roleSelect">
       <s:selectItems value="#{roles}" var="role" label="#{role.name}" noSelectionLabel="Please Select..."/>
       <s:convertEntity />
      </h:selectOneMenu>


      "role" is the name of the entity bean, or it can be the name of the factory specified in components.xml - I've tried both ways.

      "roles" can either be an outjected List or the name of the query specified in components.xml. Again, I've tried both ways.

      The option labels are always faithfully produced. It's the values...

      This is what the relevant part of components.xml looks like when it is used:
      <framework:entity-query name="roles" ejbql="select r from Role r order by r.name" />
      <framework:entity-home name="roleHome" entity-class="au.com.databaseapplications.persistence.Role" />
      <factory name="role" value="#{roleHome.instance}" />
      


      I've looked at the ui examples, over and over. I've tried roleHome.instance.name instead of role.name in h:selectOneMenu value=

      The results are the same.

      Any idea how I can get the option values to be correctly generated?

      This is Seam 1.2.1 on JBoss 4.2.0

      Thanks,