3 Replies Latest reply on Nov 18, 2009 6:46 PM by Roger Lee

    h:selectOneMenu - argument type mismatch

    Roger Lee Apprentice
      I'm using Seam 2.2.0.GA

      <h:outputLabel for="userTitles">Title</h:outputLabel>
           <h:selectOneMenu value="#{userTitles}" required="true" id="userTitles" >
                <s:selectItems value="#{userTitlesList}" var="userTitles" label="#{userTitles.title}" noSelectionLabel="Please select"/>
                <s:convertEntity/>
           </h:selectOneMenu>

      The above code works, except it always display the last title in the list retrieved from the table. i.e. in the table I have Mr. Mrs. Ms. Dr. and "Dr." will always be displayed. The title I select and save is passed back to the EJB and persisted to the table fine.

      If I change the code to;

      '
      <h:outputLabel for="userTitles">Title</h:outputLabel>
           <h:selectOneMenu value="#{userTitles.title}" required="true" id="userTitles" >
                <s:selectItems value="#{userTitlesList}" var="userTitles" label="#{userTitles.title}" noSelectionLabel="Please select"/>
                <s:convertEntity/>
           </h:selectOneMenu> '

      '
      I get the "Please select" displayed, which is what I want with the other titles in the list. However when I save it and I return to the page I get;

      /register.xhtml @63,84 value="#{userTitles.title}": java.lang.IllegalArgumentException: argument type mismatch

      In the JBoss (4.2.3.GA) Console I get;

      10:32:45,172 ERROR [STDERR] 13-Nov-2009 10:32:45 javax.faces.component.UIInput updateModel
      SEVERE: /register.xhtml @63,84 value="#{userTitles.title}": java.lang.IllegalArgumentException: argument type mismatch
      java.lang.IllegalArgumentException: argument type mismatch

      I've Googled till the cows come home and can't find (or understand) a definitive answer on how to resolve it.

      title is a String and all problems seem to be conversion from dates and numbers.

      Thanks.