JSF Composit Component mit ajax funktioniert nicht.

LStrike

Mitglied
Hallo zusammen,

cih möchte gerne eine einfache CC inkl. ajax implementieren. Das haut aber nicht so recht hin. Hat jemand einen Tipp woran es liegen könnte?

Grüße
LStrike

Code:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
  xmlns:p="http://primefaces.org/ui"
    xmlns:cc="http://java.sun.com/jsf/composite"
  xmlns:m="http://java.sun.com/jsf/composite/components/mmnet">

    <cc:interface>
        <cc:attribute name="value" required="true" />
        <cc:attribute name="id" type="String"/>
        <cc:attribute name="required" type="boolean"/>
        <cc:attribute name="multiple" type="boolean"/>
        <cc:attribute name="size" type="int" />
        <cc:attribute name="scrollHeight" type="int" default="500"/>
        <cc:attribute name="style" type="String"/>
        <cc:attribute name="styleClass" type="String"/>
        <cc:attribute name="label" type="String"/>
        <cc:attribute name="minQueryLength" type="String" default="3"/>
        <cc:attribute name="queryDelay" type="String" default="400"/>
        <cc:attribute name="disabled" type="boolean" default="false"/>
        <cc:attribute name="fullNameFormat" type="int" default="4"/>
        <cc:attribute name="ajaxEvent" type="String" />
        <cc:attribute name="ajaxUpdate" type="String"/>
        <cc:attribute name="ajaxListener" />
    </cc:interface>

    <cc:implementation>
        <p:autoComplete id="#{cc.attrs.id}" 
                      value="#{cc.attrs.value}"
                      size="#{cc.attrs.size}"
                      scrollHeight="#{cc.attrs.scrollHeight}" 
                      completeMethod="#{personListHandler.autocomplete}"
                      converter="#{entityConverter}" 
                      forceSelection="true"
                      minQueryLength="#{cc.attrs.minQueryLength}" 
                      var="_person"
                      queryDelay="#{cc.attrs.queryDelay}"
                      panelStyle="width:300px"
                      styleClass="#{cc.attrs.styleClass}"
                      style="#{cc.attrs.style}"
                      label="#{cc.attrs.label}"
                      disabled="#{cc.attrs.disabled}"
                      required="#{cc.attrs.required}"
                      itemLabel="#{_person.getFullName(cc.attrs.fullNameFormat)}"
                      itemValue="#{_person}"
                      multiple="#{cc.attrs.multiple}">

            <p:ajax event="itemSelect"  listener="#{cc.attrs.ajaxListener}" update="#{cc.attrs.ajaxUpdate}" />

         </p:autoComplete>  
    </cc:implementation>

</ui:composition>


Error:

Code:
Allgemeiner Anwendungsfehler! : javax.faces.FacesException: Unable to resolve composite component from using page using EL expression '#{cc.attrs.ajaxListener}'
 
Welche Component ID übergibst du ?

bedenke:
:formX😛arentCompId:clientCompID
das vorangestellte : für "außerhalb"

oder wenn es innerhalb der compositeComponent wäre, was hier zwar nicht der Fall ist:
"#{cc.clientId}:inputFieldId"
 
Das verstehe ich jetzt nicht so recht. Warum soll ich hier eine Component-ID übergeben?

Für mich sieht es so aus, als wenn mein " <cc:attribute name="ajaxListener" />" nicht an den "ajax" Teil durchgereicht wird, bzw, der Platzhalter nicht mit dem eigentlichen Wert ersetzt wird.
 
ups stimmt, hab gerade nur cc und ajax gelesen, Betriebsblindheit 🙂

versuch mal das
<cc:attribute name="ajaxListener" method-signature="java.lang.String action()" />
 

Zurück
Oben