簡體   English   中英

UI組件問題onPageLoad方法ADF oracle

[英]UI Component issue onPageLoad method ADF oracle

我在通過onPageLoad()方法訪問頁面中的UI componentbutton )時onPageLoad() 我將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}">

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM