4 Replies Latest reply on Aug 23, 2013 2:02 PM by bleathem

    rich:autocomplete RF 4.0 doesn't work in a composite component ?

    stefgac

      Hello,

       

      When I use this component in a JSF page like this

       

      <rich:autocomplete

      id="autocomplete"

      value="#{baliseCriteresComponent.baliseSaisie}"

      mode="client"

      autocompleteList="#{baliseCriteresComponent.baliseSuggestion}">

       

      </rich:autocomplete>

       

       

      <a4j:commandButton

      id="addBaliseCommandId"

      actionListener="#{baliseCriteresComponent.addBaliseAction}"

      value="+"/>

       

      All is working fine, the list get by baliseSuggestion is OK, the value baliseSaisie in the bean is Ok,  commandButton works.

       

      But when I put this code in a composite component like this

      <html

        xmlns:f="http://java.sun.com/jsf/core"

        xmlns:h="http://java.sun.com/jsf/html"

        xmlns:rich="http://richfaces.org/rich"

        xmlns:a4j="http://richfaces.org/a4j"

        xmlns:composite="http://java.sun.com/jsf/composite">

      <composite:interface>

        <composite:attribute

        name="backingBean"

        required="true" />

       

      </composite:interface>

      <composite:implementation>

       

        <rich:autocomplete

      id="autocomplete"

      value="#{cc.attrs.backingBean.baliseSaisie}"

      mode="client"

      autocompleteList="#{cc.attrs.backingBean.baliseSuggestion}">

       

        </rich:autocomplete>

       

      <a4j:commandButton

      id="addBaliseCommandId"

      actionListener="#{cc.attrs.backingBean.addBaliseAction}"

      value="+"/>

       

      </rich:panel>

       

      </composite:implementation>


      </html>


      And the way I use this composite component

      <l:baliseCriteres backingBean="#{baliseCriteresComponent}" />

       

       

      I've got the following issues :

      1) I must use autocompleteList instead of autocompleteMethod( Exception : the method is not found in the bean)

      2) when I  use the commandButton, the value in the bean is not initialized with the value that is in the  rich:autocomplete

       

      Do am I something wrong ?

       

      Thanks

        • 1. Re: rich:autocomplete RF 4.0 doesn't work in a composite component ?
          bcn

          I have a similar problem, maybe with the same cause:

          A bean parameter in the autocomplete method is not resolved if the rich:autocomplete is part of a ui:include.

           

          <ui:include src="/searchlocation.xhtml">

               <ui:param name="bean" value="#{searchBean}" />

          </ui:include>

           

          searchlocation.xhtml contains:

           

          <rich:autocomplete id="cityName"  mode="ajax"

          value="#{bean.cityName}"

          autocompleteMethod="#{bean.suggestCities}" >

          <rich:validator />

          </rich:autocomplete>

           

          The value binding works, but the binding in the autocompleteMethod gives:

           

          15:26:15,809 SEVERE [org.richfaces.log.Renderkit] (ajp-127.0.0.1-127.0.0.1-8009-1) Target Unreachable, identifier 'bean' resolved to null: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'bean' resolved to null

              at org.apache.el.parser.AstValue.getTarget(AstValue.java:75) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

              at org.apache.el.parser.AstValue.invoke(AstValue.java:183) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

              at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

              at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:43) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]

              at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:56) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]

              at org.richfaces.renderkit.AutocompleteRendererBase.getItems(AutocompleteRendererBase.java:105) [richfaces-components-ui-4.0.0-20110322.220419-243.jar:]

              at org.richfaces.renderkit.AutocompleteRendererBase.encodeItems(AutocompleteRendererBase.java:160) [richfaces-components-ui-4.0.0-20110322.220419-243.jar:]

              at org.richfaces.renderkit.AutocompleteRendererBase.encodeMetaComponent(AutocompleteRendererBase.java:271) [richfaces-components-ui-4.0.0-20110322.220419-243.jar:]

          • 2. Re: rich:autocomplete RF 4.0 doesn't work in a composite component ?
            bcn
            • 3. Re: rich:autocomplete RF 4.0 doesn't work in a composite component ?
              cadubad

              Try to create the code below in any place in your code. I place it in my footer.xhtml. It's worked for me.

               

              <h:selectOneMenu rendered="false" >

                <f:ajax />

                </h:selectOneMenu>

              • 4. Re: rich:autocomplete RF 4.0 doesn't work in a composite component ?
                bleathem

                From the referenced jira, it sounds like the underlying issue here was mixing JSF and CDI backing beans.  Consolidating to a single backing bean impl resolved the problem.