0 Replies Latest reply on Dec 16, 2010 3:03 PM by Fericit Bostan

    How to bind a complex object to a composite component

    Fericit Bostan Newbie

      I'm using RichFaces 4 M4 and I know this question is not specific to RichFaces, but the forum has been so helpful to me that I was hoping that someone could help me with this.


      I have written a composite component (not very complex) that will display a drop-down list of countries and should bind the selection to a provided target bean.


      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


      <html xmlns="http://www.w3.org/1999/xhtml"









          <!-- INTERFACE -->


            <composite:attribute name="label" required="true" />

            <composite:attribute name="requiredMessage" required="true"/>

            <composite:attribute name="target" required="true" type="com.mycompany.entity.Country"/>



          <!-- IMPLEMENATION -->         


          <h:panelGrid columns="2">


              <h:outputLabel for="country-list" value="#{cc.attrs.label}"/>      

              <h:panelGrid id="country" columns="1" styleClass="select-one-menu-panel" >


                  <h:selectOneMenu id="country-list"

                      enabledClass="select-one-menu-enabled" disabledClass="select-one-menu-disabled"



                      required="true" requiredMessage="#{cc.attrs.requiredMessage}"



                      <f:selectItem itemLabel="#{msgs['label.pleaseSelect']}" itemValue="" />

                      <f:selectItems value="#{countryController.countries}" />

                      <a4j:ajax />



                  <a4j:outputPanel id="country-list-error-panel" ajaxRendered="true">

                      <h:message id="country-list-error" for="country-list" style="color:red"/>









      I want to be able to use the composite component in the following way:








      When I load the page everything renders correctly, but when I select an item from the drop-down I get a validation error.


      apply-form:j_idt77:country-list: Validation Error: Value is not valid


      I know that it must be something with the way that I have the parameters defined but I simply can't find any information to help me figure this out.

      Any light that you might be able to she on this would be greatly appreciated.


      Thank you for the help...