如何调用af:jspx页面加载后弹出?

时间:2018-02-28 10:00:57

标签: javascript java oracle-adf

我有一个JSPX页面,并且正在使用ADF丰富的组件。

我有一个ADF弹出窗口,我想在页面加载时显示弹出窗口 这是第一次(刷新页面时不应该再显示)

如何实现这一目标?

这是页面的结构:

<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"

      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
      xmlns:pe="http://xmlns.oracle.com/adf/pageeditor"
      xmlns:cust="http://xmlns.oracle.com/adf/faces/customizable"
      xmlns:c="http://java.sun.com/jsp/jstl/core">   

<af:popup id="notiPopupId" rendered="#{homeBean.isThereNotif}" clientComponent="true" binding="#{homeBean.notificationsPopUp}">

<af:dialog id="notiDialogId" styleClass="message_dialog" type="none"
           title="#{portalBundle.notifications}" contentWidth="400"
           closeIconVisible="true">
<af:outputText value="my output message" />

1 个答案:

答案 0 :(得分:0)

你可以创建实现PagePhaseListener的类 并覆盖以下方法 ,像这样:

public void beforePhase(PagePhaseEvent phaseEvent) {
    UIViewRoot viewRoot = JSFUtils.getRootView2();
    if (!AdfFacesContext.getCurrentInstance().isPostback()) {
        if (phaseEvent.getPhaseId() == Lifecycle.PREPARE_RENDER_ID) {
            if (viewRoot != null) {
                String curPage = viewRoot.getViewId();
                try {
                    if (curPage != null) {
                        // call Pop Up programmatic here
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

public void afterPhase(PagePhaseEvent pagePhaseEvent) {

}

public PhaseId getPhaseId() {
    return PhaseId.RESTORE_VIEW;
}