Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/350.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在使用inputfile adf上载文件时显示弹出窗口_Java_Javascript_Popup_Oracle Adf_Jdeveloper - Fatal编程技术网

Java 如何在使用inputfile adf上载文件时显示弹出窗口

Java 如何在使用inputfile adf上载文件时显示弹出窗口,java,javascript,popup,oracle-adf,jdeveloper,Java,Javascript,Popup,Oracle Adf,Jdeveloper,我在jdeveloper与adf合作。我有一个af:inputfile,它使用valuechangelistener检查文件类型,然后上传到服务器 我需要显示弹出窗口(加载图像),而这些进程发生 我已经尝试了下面的代码,但弹出窗口总是在流程完成后显示,并且不会隐藏: 这是输入文件代码: <af:inputFile label="Invoice Document" id="if1" valueChangeListener="#{invoiceBatc

我在jdeveloper与adf合作。我有一个af:inputfile,它使用valuechangelistener检查文件类型,然后上传到服务器

我需要显示弹出窗口(加载图像),而这些进程发生

我已经尝试了下面的代码,但弹出窗口总是在流程完成后显示,并且不会隐藏:

这是输入文件代码:

<af:inputFile label="Invoice Document" id="if1" 
                    valueChangeListener="#{invoiceBatchManagedBean.onAddInvoiceDocument}"
                    showRequired="true" required="true" immediate="false"  autoSubmit="true"
                    readOnly="#{pageFlowScope.uploadPageStateViewBean.inReadOnlyState}" />
这是inputfile的valuechangelistener在managedbean中调用的函数:

    public void onAddInvoiceDocument(ValueChangeEvent valueChangeEvent) {

this.showPopup(getMyGlassPane());
    try{
        UploadedFile file = (UploadedFile) valueChangeEvent.getNewValue();
        this.onAddDocument(file, INVOICE_DOCUMENT_TYPE,true);
    }catch(Exception ex){
        RichInputFile comp = (RichInputFile) valueChangeEvent.getComponent();
        comp.setValid(false);
        comp.setValue(null);
        JSFUtils.addFacesErrorMessage(ex.getMessage());
    }
    this.hidePopup(getMyGlassPane());
}

    public void showPopup(RichPopup popup) {
    FacesContext fct = FacesContext.getCurrentInstance();
    ExtendedRenderKitService service = Service.getRenderKitService(fct, ExtendedRenderKitService.class);
    service.addScript(fct,"AdfPage.PAGE.findComponent('p1').show();");

}
//method to hide the glass pane component
public void hidePopup(RichPopup popup) {
    FacesContext fct = FacesContext.getCurrentInstance();
    ExtendedRenderKitService service = Service.getRenderKitService(fct,ExtendedRenderKitService.class);
    service.addScript(fct, "AdfPage.PAGE.findComponent('p1').hide();");
}

有人能帮忙吗?

你解释得很长,我看不出你真正的问题是什么。然而,我认为您想要实现的目标如下所述:


你解释得很长,我看不出你真正的问题是什么。然而,我认为您想要实现的目标如下所述:


您提供的链接的可能重复项将用于使用commandbutton上载的inputfile。我的inputfile不需要commandbutton来上传,因为它使用valuechangelistener上传文件(意味着它在您浏览文件后直接上传)。因此,我想实现的是在上传过程中显示弹出窗口,但没有commandbutton。我放置链接只是为了帮助您,如果您想实现不同的功能,您应该做一些变通。这个论坛是关于互相帮助尽可能多的人,但不做其他人的工作。对于您的情况,您可以从bean中触发一个客户端事件,或者只添加一个小按钮,或者在侦听器检测到某个内容时单击按钮(以编程方式),等等。“如何在使用inputfile adf上载文件时显示弹出窗口”的答案就在这些链接中。问题是我不应该添加任何按钮。我已经尝试了一些例子,也从你的链接,他们没有工作。但无论如何,谢谢。你提供的链接是为inputfile工作的,带有commandbutton上传。我的inputfile不需要commandbutton来上传,因为它使用valuechangelistener上传文件(意味着它在您浏览文件后直接上传)。因此,我想实现的是在上传过程中显示弹出窗口,但没有commandbutton。我放置链接只是为了帮助您,如果您想实现不同的功能,您应该做一些变通。这个论坛是关于互相帮助尽可能多的人,但不做其他人的工作。对于您的情况,您可以从bean中触发一个客户端事件,或者只添加一个小按钮,或者在侦听器检测到某个内容时单击按钮(以编程方式),等等。“如何在使用inputfile adf上载文件时显示弹出窗口”的答案就在这些链接中。问题是我不应该添加任何按钮。我已经尝试了一些例子,也从你的链接,他们没有工作。但无论如何,谢谢。
function enforcePreventUserInput(evt){ 
    var popup = AdfPage.PAGE.findComponentByAbsoluteId('p1');
    if (popup != null){ 
      AdfPage.PAGE.addBusyStateListener(popup,handleBusyState); 
      evt.preventUserInput(); 
    } 
  } 
  //JavaScript call back handler 
  function handleBusyState(evt){ 
    var popup = AdfPage.PAGE.findComponentByAbsoluteId('p1'); 
    if(popup!=null){ 
      if (evt.isBusy()){ 
        popup.show(); 
      } else if (popup.isPopupVisible()) { 
        popup.hide(); 
        AdfPage.PAGE.removeBusyStateListener(popup, handleBusyState); 
      } 
    } 
  } 
    public void onAddInvoiceDocument(ValueChangeEvent valueChangeEvent) {

this.showPopup(getMyGlassPane());
    try{
        UploadedFile file = (UploadedFile) valueChangeEvent.getNewValue();
        this.onAddDocument(file, INVOICE_DOCUMENT_TYPE,true);
    }catch(Exception ex){
        RichInputFile comp = (RichInputFile) valueChangeEvent.getComponent();
        comp.setValid(false);
        comp.setValue(null);
        JSFUtils.addFacesErrorMessage(ex.getMessage());
    }
    this.hidePopup(getMyGlassPane());
}

    public void showPopup(RichPopup popup) {
    FacesContext fct = FacesContext.getCurrentInstance();
    ExtendedRenderKitService service = Service.getRenderKitService(fct, ExtendedRenderKitService.class);
    service.addScript(fct,"AdfPage.PAGE.findComponent('p1').show();");

}
//method to hide the glass pane component
public void hidePopup(RichPopup popup) {
    FacesContext fct = FacesContext.getCurrentInstance();
    ExtendedRenderKitService service = Service.getRenderKitService(fct,ExtendedRenderKitService.class);
    service.addScript(fct, "AdfPage.PAGE.findComponent('p1').hide();");
}