PageLoad方法ADF oracle上的UI组件问题



在使用onPageLoad()方法访问页面中的UI componentbutton)时遇到问题。我将ADF技术与JDveloper 11.1.2.3结合使用用例是:

我正在尝试根据来自数据库的信息禁用或启用页面加载中的按钮。在我的情况下,我正在执行一个查询,检查数据库中是否有存储的文件;如果有文件,则应启用用于下载的按钮,该按钮允许用户下载该文件,否则应禁用下载按钮。我在onPageLoad()方法中尝试了以下代码:

public void onPageLoad() {  
    // loading Previous file so the user have the option to download  
    // if there is privous file stored in db  
    if ((BlobDomain)tempVO.first().getAttribute("File1") != null) {  
        System.out.println("ther is file stored in db from onPage load");  
         this.downloadButton.setDisabled(false);  
    }  
    else {  
        // if there is no file stored the download option should be disapled  
        System.out.println("no file stored in db from onPage load");  
            this.downloadButton.setDisabled(true);  
    }  

并且我在执行之前的代码后得到了这个错误:

<UIXRegion> <_logIllegalContextChangeMessage> ADF_FACES-10026:During the processing of the region component, either a context change was not found or it did not match the instance set up by the current component. Expected oracle.adf.view.rich.component.fragment.UIXRegion$RegionContextChange but found UIXCollection.CollectionComponentChange[Component class: oracle.adf.view.rich.component.rich.data.RichTable, component ID: t1].
<RichExceptionHandler> <_logUnhandledException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase INVOKE_APPLICATION 5
oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.lang.NullPointerException, msg=null

这是一种错误的方法。

您应该在绑定层中绑定文件属性。然后使用EL检查其在组件属性中是否为空已禁用

<af:inputFile disabled="#{bindings.File.inputValue == null}">

最新更新