【问题标题】:JSF Composite Component with ajax won't work带有 ajax 的 JSF 复合组件不起作用
【发布时间】:2013-10-28 11:25:45
【问题描述】:

我想开发一个带有 ajax 处理程序的小型 JSC 复合组件,但它不起作用。 需要提示这里出了什么问题:

代码:

 <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>

错误:

Allgemeier Anwendungsfehler! :javax.faces.FacesException:无法 使用 EL 表达式从使用页面解析复合组件 '#{cc.attrs.ajaxListener}'

问候 罢工

【问题讨论】:

    标签: jsf primefaces composite-component


    【解决方案1】:

    解决了。

    ajax 监听器的属性必须声明如下:

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

    感谢 java-forum.org 的“sence”: Thread @ java-forum.org

    【讨论】:

      猜你喜欢
      • 2013-05-03
      • 2015-11-22
      • 1970-01-01
      • 2011-07-23
      • 1970-01-01
      • 2013-02-02
      • 1970-01-01
      • 2012-07-11
      • 2014-01-17
      相关资源
      最近更新 更多