1
내 Bean에서 Dialog를 열 수 없습니다. 나는 대신 action
JSF : Primefaces : RequestContext를 사용하여 Bean에서 Dialog를 열 수 없습니다.
이 내 JSF는 모습입니다의 actionListener
을 시도 같은 :
<ui:composition template="../templates/site.xhtml" 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:p="http://primefaces.org/ui" xmlns:sec="http://www.springframework.org/security/tags"> <!-- remove me just for encoding check ä --> <ui:define name="content"> <h:form id="form"> <h:panelGrid columns="1" cellpadding="5"> <p:commandButton value="Button" type="button" id="myButton" action="#{testBean.showDialog}" /> </h:panelGrid> </h:form> <p:dialog id="testDialog" widgetVar="testDialog2" header="My Test Dialog" modal="true" appendToBody="true"> <h:form> <h:outputText value="Output" /> </h:form> </p:dialog> </ui:define>
그리고 이것은 내 콩
@Component
@Scope("view")
public class TestBean {
public void showDialog(){
RequestContext.getCurrentInstance().execute("testDialog2.show()");
}
}