Jakarta ee Can';t从复合组件调用PrimeFaces commandButton的actionListener
我在另一个复合组件中有一个复合组件。内部组件有一个绑定到Jakarta ee Can';t从复合组件调用PrimeFaces commandButton的actionListener,jakarta-ee,jsf-2,primefaces,Jakarta Ee,Jsf 2,Primefaces,我在另一个复合组件中有一个复合组件。内部组件有一个绑定到actionListener的p:commandButton,它看起来像: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
actionListener
的p:commandButton
,它看起来像:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
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:cc="http://java.sun.com/jsf/composite"
xmlns:uv="http://java.sun.com/jsf/composite/components/views/core">
<cc:interface>
<cc:attribute name="organizationController" type="core.components.OrganizationController" required="true"/>
</cc:interface>
<cc:implementation>
<uv:organizationDataSearch id="srcOrganization343423"
controller="#{cc.attrs.organizationController}"
title="testOutter"/>
</cc:implementation>
</html>
PrimeFaces我使用的是3.0版。
JSF实现是第2.0次mojarra
问题在于actionListener(cc.attrs.controller.search(true))
,当我尝试搜索数据时,不会调用这个函数。有趣的是,当我使用h:commandButton
或者在简单的组合中使用内部的复合组件时,一切都很好。
谁知道这里有什么问题 如果我理解正确,则根本不调用该方法。出于好奇:你能用一个方法测试它吗?
public void search(){…}
并像调用JavaBeanactionListener=“#{cc.attrs.controller['search']}”
?好的,没有看到任何真正的原因。在更新
中添加一个组件,该组件包含类似于h:messages
-标记的内容。通过这种方式,您会注意到是否发生了转换器错误或类似错误,并且这种方式会阻止调用该方法(JSF生命周期)。我还将检查(因为p:commandButton是AJAX)例如FireBug,查看单击按钮的服务器响应。祝你好运,谢谢。我将试着用它调试)看来“execute”的调用方式不对。我刚刚进行了调试,得到了以下结果:“执行”阶段以恢复视图阶段结束,然后进入渲染响应阶段。在同一时刻,p:messages上没有任何消息。
<cc:interface>
...
<cc:attribute name="controller" type="core.components.OrganizationController" required="true"/>
...
</cc:interface>
<cc:implementation>
...
<p:outputPanel id="searchPanel" ...>
<p:outputPanel id="searchPanel" styleClass="searchPanel">
<!--search fields with using of h:inputText -->
<p:commandButton id="searchButton"
value="Search"
actionListener="#{cc.attrs.controller.search(true)}"
process="searchPanel, @this"
update="searchResultPanel"
styleClass="searchButton" />
</p:outputPanel>
..
<p:outputPanel id="searchResultPanel" layout="block" styleClass="searchResultPanel">
<p:dataTable id="searchResultTable" .../>
</p:outputPanel>
...
</cc:implementation>
public void search(Boolean isInnSearch) {...}