0 Replies Latest reply on Mar 25, 2009 4:36 PM by peter irmstadt

    Assigning a value of a <h:selectOneMenu> to a stateless session bean

    peter irmstadt Newbie


      I populated a selectOneMenu with data given from an entity bean called 'domain'.

      I created the following .xhtml code:

                <h:selectOneMenu value="#{domain}">
                <s:selectItems var="dom" value="#{user.domains}" label="#{dom.name}" noSelectionLabel="Choose one"></s:selectItems>
                <s:convertEntity />
                <h:commandButton action="#{manager.action}" value="OK"  type="submit"/>

      that generates the following .html output:

      <select name="j_id22:j_id23" size="1">
      <option value="org.jboss.seam.ui.NoSelectionConverter.noSelectionValue">Choose one</option>
           <option value="0">domain1.net</option>
           <option value="1">domain2.net</option>
      </select><input type="submit" name="j_id22:j_id25" value="OK" />

      while the values represent the (correct) database index of the related domain names.

      I want to work with the selection the user did, so I created the following stateless session bean

      public class Manager implements IManager 
           @In(required = false)
           private Domain domain = null;
           public Domain getDomain() {
                return domain;
           public void setDomain(Domain domain) {
                this.domain = domain;
           @Logger private Log log;
           public String action()
                log.info("Domain: {0}", (domain != null) ? domain.getName() : "none" ); 
                return null;
      public interface IManager
           public String action();

      But when I select an entry and click on the button, the following erorr is thrown:

      NFO  [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
      sourceId=j_id22:j_id23[severity=(ERROR 2), summary=(j_id22:j_id23: Validierungs-Fehler: Wert nicht gültig.), detail=(j_id22:j_id23: Validierungs-Fehler: Wert nicht gültig.)]

      while the German stuff means 'Validation error: Value is invalid.'

      Do you know what I did wrong?

      Thank you in advance!