1 Reply Latest reply on Aug 12, 2009 12:44 AM by Gena Batalski

    h:selectOneMenu s:selectItems sending selected bean value.

    Nagendra krishnawat Newbie

      I have a dropdown list for UI:


      CustodianAccountCreate.xhtml code:


      <h:selectOneMenu value="#{custodianAccountHome.instance.bank}" style="width:110px" required="true" >
                              <s:selectItems value="#{allCustodians}" var="bankVar"  label="#{bankVar.name}" noSelectionLabel="Please Select.."/>
                          </h:selectOneMenu>



      Here allCustodians is variable from seam context which is a list of bank object.


      If you notice h:selectOneMenu has value custodianAccountHome.instance.bank where bank is an member of CustodianAccount class.


      @Entity
      public class CustodianAccount {


      @ManyToOne
      Bank bank;


      }


      My question is What is standard way to send the selected value to back end.
      I get exceptions like "Value not valid" when I dont use s:convertEntity
      or "Argument type mismatch" when I use s:convertEntity.


      Do I have to use entityConverter.


      -Tkx

        • 1. Re: h:selectOneMenu s:selectItems sending selected bean value.
          Gena Batalski Newbie

          I think, following should work if the custodianAccountHome.instance.bank is of compatible type with elements of allCustodians:


          <h:selectOneMenu value="#{custodianAccountHome.instance.bank}" style="width:110px" required="true" >
                                  <s:selectItems value="#{allCustodians}" var="bankVar"  label="#{bankVar.name}" noSelectionLabel="Please Select.."/>
          <s:convertEntity/>
                              </h:selectOneMenu>
          



          If it doesn't work, where is the Argument type mismatch thrown?