给定以下实现,在composite中设置正确的值是什么:actionSource @ name或@targers,以便我的actionSource引用a4j:commandButton @ id =“yes”
<composite:implementation>
<a4j:commandButton value="Delete selected" execute="@this"
oncomplete="#{rich:component('confirmDeletePopup')}.show()"/>
<rich:popupPanel id="confirmDeletePopup">
<h:form id="confirmForm">
<a4j:outputPanel id="confirmDeletePanel" styleClass="popup">
<h:panelGroup rendered="#{not empty cc.attrs.deleteSelectedBean.selection}">
Are you sure?
<div class="popupButtons">
<a4j:commandButton value="Yes" id="yes"
execute="@this"
action="#{cc.attrs.deleteSelectedBean.deleteSelected()}"
oncomplete="#{rich:component('confirmDeletePopup')}.hide(); return false"/>
<h:commandButton styleClass="yesNo"
value="No" immediate="true">
<rich:componentControl target="confirmDeletePopup" operation="hide" />
</h:commandButton>
</div>
</h:panelGroup>
<h:panelGroup rendered="#{empty cc.attrs.deleteSelectedBean.selection}">
First choose what you want to delete!
<div class="popupButtons">
<h:commandButton value="Cancel" immediate="true">
<rich:componentControl target="confirmDeletePopup" operation="hide" />
</h:commandButton>
</div>
</h:panelGroup>
</a4j:outputPanel>
</h:form>
</rich:popupPanel>
</composite:implementation>
编辑: 截至目前,我尝试了name =“yes”:
<composite:interface>
<composite:attribute name="deleteSelectedBean" type="pl.aw.presentation.common.DeleteSelectedEntitiesBean"/>
<composite:attribute name="render" />
<composite:actionSource name="yes"/>
</composite:interface>
尝试按如下方式引用actionSource:
听众如下:
public class OrganizationListBean {
//...
public ActionListener getDeleteListener() {
return new ActionListener() {
@Override
void processAction(ActionEvent event) throws AbortProcessingException {
System.out.println("listener run");
}
}
}
}
但代码未执行。
我也尝试过添加(由Intellij Idea自动完成提议)targets="confirmDeletePopup:confirmForm:confirmDeletePanel:yes"
但是我得到了
java.lang.IllegalArgumentException: confirmDeletePopup
at javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:612) [jboss-jsf-api_2.1_spec-2.1.18.Final.jar:2.1.18.Final]
at com.sun.faces.facelets.tag.composite.AttachedObjectTargetImpl.getTargets(AttachedObjectTargetImpl.java:96) [jsf-impl-2.1.29-03.jar:2.1.29-03]
我使用JBoss EAP 6.1.Alpha和Mojarra升级到jsf-impl-2.1.29-03。
答案 0 :(得分:0)