2013-02-05 2 views
1

내 Bean에서 Dialog를 열 수 없습니다. 나는 대신 actionJSF : 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()"); 
    } 


} 

답변

3

귀하의 showDialog() 방법 전혀 호출되지 않습니다. 누름 단추가 아닌 AJAX 사용 가능 제출을 사용하려면 type="button"을 제거하십시오.