backing bean 메서드의 결과에 따라 팝업 패널을 표시하는 복합 구성 요소를 렌더링하려고합니다. 지금까지 성공하지 못했습니다. 도움을 주시면 감사하겠습니다.
복합 구성 요소 (conditionalActionLink.xhtml) :
<ui:component
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:composite="http://java.sun.com/jsf/composite">
<composite:interface>
<composite:attribute name="value"/>
<composite:attribute name="style"/>
<composite:attribute name="disabled"/>
<composite:attribute name="render"/>
<composite:attribute name="message" />
<composite:attribute name="renderedBtn" type="java.lang.Boolean"/>
<composite:attribute name="condition" required="true" method-signature="java.lang.Boolean action()"/>
<composite:attribute name="execAction" required="true" method-signature="void action()"/>
</composite:interface>
<composite:implementation>
<ui:debug hotkey="x" />
<h:form>
<a4j:commandLink id="actnlnx" value="#{cc.attrs.value}" oncomplete="#{managePurchases.billHasPaymentsApplied ? showMessage() : submitToServer() }" style="#{cc.attrs.style}" disabled="#{cc.attrs.disabled}"/>
<a4j:jsFunction name="showMessage" onbegin="#{rich:component('noticeDialog')}.show()" execute="@form"/>
<a4j:jsFunction name="submitToServer" action="#{cc.attrs.execAction}" render="#{cc.attrs.render}" execute="@form"/>
<rich:popupPanel id="noticeDialog" modal="true" autosized="true" resizeable="false" style="FONT-SIZE: large;">
<f:facet name="header" style="FONT-SIZE: large;">
<h:outputText value="Notice" />
</f:facet>
<f:facet name="controls">
<h:outputLink value="#" onclick="#{rich:component('noticeDialog')}.hide(); return false;">
X
</h:outputLink>
</f:facet>
<h:outputText value="#{cc.attrs.message}"/>
<br/><br/>
<h:commandButton value="Ok" onclick="#{rich:component('noticeDialog')}.hide(); return false;" style="FONT-SIZE: large;"/>
</rich:popupPanel>
</h:form>
</composite:implementation>
호출 페이지 :
<cc:conditionalActionLink value="Delete" style="FONT-SIZE: large;text-decoration:none" message="This bill has payments applied. Please delete payments first." condition="#{managePurchases.billHasPaymentsApplied}" execAction="#{managePurchases.deleteBill}"/>
Btw, 복합 구성 요소에서 조건 값을 사용해야하지만 중첩 된 EL 표현식을 피하는 방법에 문제가 있습니다. oncomplete="#{cc.attr.condition ? showMessage() : submitToServer() }"
백킹 빈 :
public Boolean getBillHasPaymentsApplied(){
applogger.entry();
//if(bill.getPayments().size() > 0)
return applogger.exit(true);
//else
//return applogger.exit(false);
}
public void deleteBill(){
applogger.entry();
applogger.debug("DELETE BILL HERE.");
//billDaoBean.deleteBill(bill);
applogger.exit();
}
나는 온라인에서 많은 검색을 통해 많은 조정을 시도했습니다. 이 특정 버전에서 오류 메시지는 다음과 같습니다.
javax.el.ELException : 'showMessage'함수를 찾을 수 없습니다.
이 행동을 달성 할 방법을 찾고 있습니다.
미리 도와 주셔서 감사합니다!
구성 요소 의 oncomplete
속성은 . 여기서 EL 은 찾을 수없는 부울 값에 따라 또는 Java 메서드 를 호출하려고합니다 .<a4j:commandLink>
String
showMessage()
submitToServer()
원하는 것은 String
JS 함수 이름을 사용하는 것이므로 작은 따옴표 사이에 함수 이름을 넣으면됩니다 String
.
oncomplete="#{managePurchases.billHasPaymentsApplied ? 'showMessage()' : 'submitToServer()'}"
나는 RichFaces가 준비된 플레이 그라운드가 없기 때문에 (RichFaces도 사용하지 않았습니다), 그래서 테스트 할 수는 없지만 트릭을해야합니다!
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다