Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JSF-custom标记-selectonemenu-ajax侦听器_Ajax_Jsf_Listener_Selectonemenu_Actionevent - Fatal编程技术网

JSF-custom标记-selectonemenu-ajax侦听器

JSF-custom标记-selectonemenu-ajax侦听器,ajax,jsf,listener,selectonemenu,actionevent,Ajax,Jsf,Listener,Selectonemenu,Actionevent,我使用JSF2.2和primefaces 5.2 我的页面带有Primefaces的本机代码。它的工作原理是: 我的控制器: public void onContinentChange() { LOGGER.logDebug(">>>>>>>>>>>>>>>>>>>> {%s}", continentCode); countries = list("COUNTR

我使用JSF2.2和primefaces 5.2

我的页面带有Primefaces的本机代码。它的工作原理是:

我的控制器:

public void onContinentChange() {
    LOGGER.logDebug(">>>>>>>>>>>>>>>>>>>> {%s}", continentCode);
    countries = list("COUNTRY_BY_CONTINENT", new String[] {continentCode});
}

public ListBean getCountries() {
    return countries;
}

感谢您的回答

我想这是因为您为自定义标记的listener属性而不是方法表达式添加了字符串值。用{和}包装属性值:


如果使用此表达式,我检索到另一个错误,如programController中名为“onContinentChange”的不存在属性。这是真的,因为它是一个方法,而不是具有get/set方法的属性。如果将括号添加到该方法:{programController.onContinentChange}?listener=programController.onContinentChange not work
<mp:select_one id="continent" rendered="true" required="false"
                            label="#{bundleMessage['label.key']}"
                            value="#{programController.continentCode}"
                            list="#{programController.continents.listResult}"
                            item_label="#{item.name}" item_value="#{item.code}"
                            listener="programController.onContinentChange"
                            update="search_form:country" immediate="true"/>
<p:selectOneMenu id="#{id}" styleClass="#{styleClass}" required="#{required}" value="#{value}" rendered="#{rendered}">

       <p:ajax listener="#{listener}" 
               update="#{update}" 
               immediate="#{immediate}" />

        <f:selectItems value="#{list}" 
           var="item" 
           itemLabel="#{item_label}" itemValue="#{item_value}" />

</p:selectOneMenu>
com.sun.faces.lifecycle.ApplyRequestValuesPhase execute
WARNING: /WEB-INF/mp-tags/select_one.xhtml @119,33 listener="#{listener}": Identity 'listener' does not reference a MethodExpression instance, 
returned type: java.lang.String
javax.el.ELException: /WEB-INF/mp-tags/select_one.xhtml @119,33 listener="#{listener}": Identity 'listener' does not reference a MethodExpression instance, returned type: java.lang.String
public void onContinentChange() {
    LOGGER.logDebug(">>>>>>>>>>>>>>>>>>>> {%s}", continentCode);
    countries = list("COUNTRY_BY_CONTINENT", new String[] {continentCode});
}

public ListBean getCountries() {
    return countries;
}
listener="#{programController.onContinentChange}"