Jsf 在操作之前打开弹出窗口

Jsf 在操作之前打开弹出窗口,jsf,Jsf,在上述代码中,单击链接时,在操作完成之前打开弹出窗口 操作完成后是否可以打开?只需将要执行的逻辑移动到操作的目标页面即可 首先,单击删除onclick: <h:commandLink action="#{bean.action}" onclick="window.open('../note/note.faces', 'popupWindowName', 'dependent=yes, menubar=no, toolbar=no, height=450, width=700');">

在上述代码中,单击链接时,在操作完成之前打开弹出窗口


操作完成后是否可以打开?

只需将要执行的逻辑移动到操作的目标页面即可

首先,单击删除
onclick

<h:commandLink action="#{bean.action}" onclick="window.open('../note/note.faces', 'popupWindowName', 'dependent=yes, menubar=no, toolbar=no, height=450, width=700');">
最后根据
{bean.executed}
有条件地显示JS代码:

private boolean executed;

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

public boolean isExecuted() {
    return executed;
}

window.open('../note/note.faces','popupWindowName','dependent=yes,menubar=no,toolbar=no,高度=450,宽度=700');

我想在上面的代码中添加一个链接,并在其中提到该操作。您似乎误解了我的答案。我已经改进了答案。@BalusC,在这里我不明白如何基于bean.executed进行JS的条件显示。我猜无论bean.executed是真是假,JS都会执行。那么如何显示javascript部分呢?
private boolean executed;

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

public boolean isExecuted() {
    return executed;
}
<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>