java - 将信息从弹出窗口传递到 Oracle ADF 上的主窗口

标签 java oracle popup oracle-adf

我有一个弹出窗口,显示包含数据的表格,我可以选择一行,然后按“确定”按钮,我可以检索表中所选行的 idNo。

我想要做的是将这个 idNo 传递给调用弹出窗口的窗口并更新该窗口上的outputText。

有人可以帮助我吗?

按钮代码:

按钮的 newBean 类:

 public String b1_action() {
        // Add event code here...

        System.out.println("Select One Button has been Clicked");

            // Get bindings associated with the current scope, then access the one that we have assigned to our table - e.g. OpenSupportItemsIterator
            DCBindingContainer bindings =
                (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
            DCIteratorBinding dcItteratorBindings =
                bindings.findIteratorBinding("NameView1_1Iterator");

            // Get an object representing the table and what may be selected within it
            ViewObject voTableData = dcItteratorBindings.getViewObject();

            // Get selected row
            Row rowSelected = voTableData.getCurrentRow();

            // Display attriebute of row in console output - would generally be bound to a UI component like a Label and or used to call another proces
            System.out.println(rowSelected.getAttribute("IdNo"));

            setOutputText("" + rowSelected.getAttribute("IdNo") + "");
            closePopup("p1");

        return null;
    }

我希望我的函数:setOutputText()尚未实现,以便能够更新主窗口上的outputText。

谢谢 最好的问候

最佳答案

根据您希望如何保留该值,将“IdNo”放入 View 或页面流范围中。

//view scope
AdfFacesContext.getCurrentInstance().getViewScope().put("IdNo", value);

//or page flow scope
AdfFacesContext.getCurrentInstance().getPageFlowScope.put("IdNo", value);

在窗口 bean 中,为弹出对话框编写一个监听器:

public void dialogCloseListener(DialogEvent dialogEvent) {
    if (dialogEvent.getOutcome().equals(DialogEvent.Outcome.ok)) {
        String idNo = AdfFacesContext.getCurrentInstance().getViewScope().get("IdNo");
        //now you have the idNo, do whatever you want

    }
}

关于java - 将信息从弹出窗口传递到 Oracle ADF 上的主窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19384995/

相关文章:

java - 放入 Map 时出现非法状态异常

javascript - 数据库查询在带有 oracledb 的 node.js 中返回未定义的值

数据库组织Oracle

java - 配置 mybatis 使用现有连接

用于显示弹出网格的 Javascript 方程式

jQuery UI 对话框手动关闭

Java:为示例数据库应用程序构建 webapp UI

java - 字符串缓冲区方法 "toString"

java - 如何使用 JSP 实现此模式

JAVA:如何让弹出窗口自动关闭?