Проблема компонента пользовательского интерфейса onPageLoad, метод ADF oracle

Я столкнулся с проблемой доступа к UI component (button) на странице в методе 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

person Salman    schedule 04.12.2013    source источник


Ответы (1)


Это просто неправильный подход.

Вы должны привязать свой атрибут file к слою привязок. Затем с помощью EL проверьте, пусто ли оно в свойстве компонента отключено.

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

person Nagh    schedule 04.12.2013