Java ADF将数据从Excel导入ADF表
我希望通过adf将一系列数据从excel导入我的表格。我遵循这个博客的方式,但仍然没有做到这一点。有什么建议吗?我甚至不能从页面上的值更改侦听器简单调用valueChangeEvent。下面是我的代码Java ADF将数据从Excel导入ADF表,java,oracle-adf,Java,Oracle Adf,我希望通过adf将一系列数据从excel导入我的表格。我遵循这个博客的方式,但仍然没有做到这一点。有什么建议吗?我甚至不能从页面上的值更改侦听器简单调用valueChangeEvent。下面是我的代码 ADF Page: <af:panelGroupLayout id="pgl2"> <af:inputFile label="File:" id="if1" valueChangeListener="#{
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>**
您是否在表单中添加了“usesUpload=true”?1是否需要实现?我已经试过这个方法了。除此之外,我还错过了其他东西吗?请告诉我们您的确切Jdev版本!还有其他关于丢失文件的示例可用。你有没有试过其他与来源完全一致的样品?@TimoHahn我已经找到了答案。要在页面片段中运行此功能,您只需通过一个窗格选项卡将其包装。然后你可以像往常一样运行它。