2011-03-04 7 views
2
<h:commandLink action="#{bean.action}" onclick="window.open('../note/note.faces', 'popupWindowName', 'dependent=yes, menubar=no, toolbar=no, height=450, width=700');"> 

위 코드에서 링크를 클릭하면 작업이 완료되기 전에 팝업이 열립니다.조치 전에 팝업이 열림

조치가 완료된 후 열 수 있습니까?

답변

2

실행될 논리를 작업의 대상 페이지로 이동하십시오.

먼저 제거 onclick :

<h:commandLink action="#{bean.action}"> 

그런 확장하여 다음과 Bean 같이

private boolean executed; 

public String action() { 
    executed = true; 
    return "targetpage"; 
} 

public boolean isExecuted() { 
    return executed; 
} 

을 마지막으로 조건부 #{bean.executed}에 따라 JS 코드 표시 :

<h:panelGroup rendered="#{bean.executed}"> 
    <script type="text/javascript"> 
     window.open('../note/note.faces', 'popupWindowName', 'dependent=yes, menubar=no, toolbar=no, height=450, width=700'); 
    </script> 
</h:panelGroup> 
+0

내가 원하는에를 하나의 링크를 넣고 위의 코드에서 동작을 언급 할 위치 . – venkat

+0

내 대답을 오해하는 것 같습니다. 나는 그 해답을 향상시켰다. – BalusC

+0

발루 감사합니다. – venkat