java - 在 Oracle ADF 上使用 row.setAttribute 获取 NullPointerException

标签 java nullpointerexception weblogic jdeveloper oracle-adf

我现在正在尝试学习 Oracle ADF,但在 Java bean 上运行以下代码时遇到 NullPointerException。 你能帮我弄清楚我做错了什么吗?这是从 JSPX 页面上的按钮调用的。

public String cb1_action() {
    try{
        BindingContext bindingctx = BindingContext.getCurrent();
        BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
        DCBindingContainer bindingsImpl = (DCBindingContainer)bindings;
        DCIteratorBinding iter = bindingsImpl.findIteratorBinding("ViewObj1Iterator");


        Row row = iter.getCurrentRow();

        row.setAttribute("Id", 123);
        row.setAttribute("Nome", "Pedro Teste");

    }
    catch(Exception e) {
        System.out.println("Excepcao em: ");
        e.printStackTrace();
    }

    return null;
}

根据堆栈跟踪,错误发生在第一 row.setAttribute() 行。 另外,我正在使用最新版本的 JDeveloper 和集成的 WebLogic 服务器。

最诚挚的问候,

佩德罗

最佳答案

Row row = iter.getCurrentRow();
if(row  != null){
    row.setAttribute("Id", 123);
    row.setAttribute("Nome", "Pedro Teste"); //name?
}

关于java - 在 Oracle ADF 上使用 row.setAttribute 获取 NullPointerException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12863666/

相关文章:

java - 使用 JNA 创建 CFString 对象

JAVA Windows 计算器 - 输出上的反向重复是恒定的

java - 如何在微服务架构(HAL、ALPS)中为 Restful 服务正确设置文档

java - 为什么 System.out.println() 不抛出 NullPointerException?

java - 原生查询导致空指针异常

Java - 方法中的 NullPointerException

android - 在 Switch 上设置 onSetCheckedListener 时出现运行时异常

java - Weblogic 12.2.1,链接错误

java - 在单个 Weblogic 域中的同一集群中部署两个 Spring 批处理应用程序?

java - Java 中的 Web 服务 - 高级特性 - weblogic