RichFaces fileUpload无法随机调用侦听器

时间:2016-03-30 12:31:19

标签: file-upload richfaces

我在使用richfaces时遇到问题。我有一个.jsp页面,我正在使用rich:fileUpload。当我上传excel文件时,它应该用相应的值填充数据表。在localhost上它完美地工作。每当我在网站上试用它时,它的工作时间为90-95%。我一直在尝试许多解决方案,试图找出这个bug的来源,但它是没有希望的。 请有人帮帮我吗?

            <h:form>    
                <table>                 
                    <tr>                      
                      <td>
                         <rich:fileUpload fileUploadListener="#{uploadToolBB.fileUploadListener}" id="uploadFile" ajaxSingle="true" allowFlash="false"
                                     immediateUpload="false" listHeight="57px" listWidth="485px"  maxFilesQuantity="1"  acceptedTypes="xlsx"  
                                     noDuplicate="true" doneLabel="The file has been successfully uploaded" validatorMessage="An error occured while uploading the file">
                                <a4j:support event="onuploadcomplete" reRender="exceptionPanel,dataLst,uploadFile,fileName" oncomplete="Richfaces.hideModalPanel('importPanel');"/>
                                <a4j:support event="onclear" reRender="uploadFile" />
                                <f:facet name="label">
                                    <h:outputText value="{_KB}KB from {KB}KB uploaded --- {mm}:{ss}" /> 
                                </f:facet>
                        </rich:fileUpload>
                      </td>
                    </tr>                       
                </table>
            </h:form>

当我们点击上传时,数据表应该填充值,但是它不是..日志中没有显示错误,我只能得到它没有调用bean中的fileUploadListener方法。

public void fileUploadListener(UploadEvent event) 
{
  try {
      UploadItem item = event.getUploadItem();
      includedFabsHM.clear();
      selecedUploadHist.setFileName(item.getFileName());
      FctUploadedFileVO uploadedFile = new FctUploadedFileVO();
      uploadedFile.setFile(item.getData());
      selecedUploadHist.setUploadedFile(uploadedFile);

      uploadToStagingTable(item.getData());

      if(selecedUploadHist.getUploadHistoryId()!=0)
      {
          newFileUploaded = true;  
      }

    }
    catch (Exception e) 
    {
        FacesUtil.handleFPException(FacesContext.getCurrentInstance(), e);
    }
}

0 个答案:

没有答案