簡體   English   中英

ADF 將數據從 Excel 導入 ADF 表

[英]ADF Import Data From Excel Into ADF Table

我希望通過adf將一系列數據從excel導入到我的表中。 我按照這個博客的方式( http://technology.amis.nl/2010/09/16/adf-11g-import-from-excel-into-an-adf-table )但仍然沒有這樣做。 有什么建議嗎? 我什至不能從我頁面上的值更改偵聽器中簡單地調用 valueChangeEvent。 下面是我的代碼

  ADF Page:
  <af:panelGroupLayout id="pgl2">
          <af:inputFile label="File:" id="if1"
                        valueChangeListener="#{uploadTelephoneUsageBean.fileUploaded}"
                        autoSubmit="true"/>
          <af:commandButton text="Upload" id="cb1"
                            actionListener="#{uploadTelephoneUsageBean.check_file_upload}"/>
        </af:panelGroupLayout>
 Request Scope Manage Bean:
     public void fileUploaded(ValueChangeEvent valueChangeEvent) {
    // Add event code here...        
    UIComponent Temp_uic=valueChangeEvent.getComponent();
    Temp_uic.processUpdates(FacesContext.getCurrentInstance());
    FacesContext.getCurrentInstance().renderResponse();

    System.out.println("Check value change ");
    try {
        UploadedFile file = (UploadedFile)valueChangeEvent.getNewValue(); 
        parseFile(file.getInputStream());
        AdfFacesContext.getCurrentInstance().addPartialTarget(valueChangeEvent.getComponent());
        eventADF=valueChangeEvent;
    } catch (IOException e){

        e.printStackTrace();
    }

}

沒有顯示語法錯誤消息。 我無法查看“檢查值更改”。 關於這個問題的任何想法?

對於 ADF 版本 11g 11.1.1.7.0,以便從頁面片段中的 excel 導入數據。 您需要在其頂部放置一個面板選項卡。 否則它會顯示錯誤消息。 我的代碼如下:

  **<af:panelTabbed id="pt1">**
    <af:showDetailItem text="File Upload" id="sdi1"
                       styleClass="AFStretchWidth">
      <af:inputText value="#{bindings.InvoiceNumber.inputValue}"
                    label="#{bindings.InvoiceNumber.hints.label}"
                    required="#{bindings.InvoiceNumber.hints.mandatory}"
                    columns="#{bindings.InvoiceNumber.hints.displayWidth}"
                    maximumLength="#{bindings.InvoiceNumber.hints.precision}"
                    shortDesc="#{bindings.InvoiceNumber.hints.tooltip}"
                    id="it31">
        <f:validator binding="#{bindings.InvoiceNumber.validator}"/>
      </af:inputText>
      <af:spacer width="20" height="20" id="s2"/>
      <af:inputFile id="if1" autoHeightRows="0" label="File:"
                    value="#{UploadTelephoneUsageBean.uploadFile}"
                    valueChangeListener="#{UploadTelephoneUsageBean.fileUploaded}"/>
      <af:spacer width="10" height="10" id="s1"/>
      <af:commandButton text="Upload" id="cb1" partialSubmit="true"
                        actionListener="#{UploadTelephoneUsageBean.check_file_upload}"/>
    </af:showDetailItem>
  **</af:panelTabbed>**

暫無
暫無

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

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