[英]Import data from XLS and XLSX (Excel) to ADF Table Using Apache POI
[英]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.