本文介绍了从datatable导出数据使用2.0版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面,我将一些数据加载到数据表中,并提供三个按钮,用于导出到pdf,xls和csv。我使用了Primefaces在其网页中的相同示例代码:

 < h:commandLink> 
< p:graphicsImage value =../ resources / images / Excel.png/>
< p:dataExporter type =xlstarget =grdAuditfileName =ApplicationLog/>
< / h:commandLink>

当我点击commandLink时,我收到以下异常错误:

  java.lang.NoClassDefFoundError:com / lowagie / text / DocumentException 
在org.primefaces.component.export.PDFExporter.export(PDFExporter.java: 45)
在org.primefaces.component.export.DataExporter.processAction(DataExporter.java:94)
在javax.faces.event.ActionEvent.processListener(ActionEvent.java:84)
在javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:773)
在javax.faces.component.UICommand.broadcast(UICommand.java:296)
在javax.faces.component.UIViewRoot .broadcastEvents(UIViewRoot.java:783)
在javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1248)
在com.sun.faces.lifecycle.InvokeApplicationPhase.execute
(InvokeApplicationPhase.java:77)
在com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
在com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java :114)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
在weblogic.servlet.internal.StubSecurityHelper $ ServletServiceAction.run
(StubSecurityHelper.java:227)
在weblogic。 servlet.internal.StubSecurityHelper.invokeServlet
(StubSecurityHelper.java:125)
在weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
在weblogic.servlet.internal。 TailFilter.doFilter(TailFilter.java:26)
在weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
在org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter。 java:79)
在weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
在weblogic.servlet.internal.RequestEventsFilter.doFilter
(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext $ ServletInvocationAction.wrapRun
(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext $ ServletInvocationAction.run
(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs
(AuthenticatedSubject。 java:321)
在weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
在weblogic.servlet.internal.WebAppServletContext.securedExecute
(WebAppServletContext.java:2277)
在weblogic.servlet.internal.WebAppServletContext.execute
(WebAppServletContext.java:2183)
在weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
在weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
在weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
导致:java.lang.ClassNotFoundException:com.lowagie .text.DocumentException
在weblogic.utils.classloaders.GenericClassLoader.findLocalClass
(GenericClassLoader.java:297)
在weblogic.utils.classloaders.GenericClassLoader.findClass
(Generi cClassLoader.java:270)
在weblogic.utils.classloaders.ChangeAwareClassLoader.findClass
(ChangeAwareClassLoader.java:64)
在java.lang.ClassLoader.loadClass(ClassLoader.java:305)
在java.lang.ClassLoader.loadClass(ClassLoader.java:246)
在weblogic.utils.classloaders.GenericClassLoader.loadClass
(GenericClassLoader.java:179)
在weblogic .utils.classloaders.ChangeAwareClassLoader.loadClass
(ChangeAwareClassLoader.java:43)
... 29更多

显然,这个类缺少:com.lowagie.text.DocumentException,但是我不知道如何得到它,在哪里安装它,也不是为什么出现错误。任何想法?

解决方案


  • iText-2.1.5.jar

  • poibin-3.7-20101029.zip



同时下载并导入到项目中,它将解决您的错误。


I have a page where I load some data into a datatable and provide three buttons for export to pdf, xls and csv. I used the same sample code Primefaces has in its web page:

<h:commandLink>
   <p:graphicImage value="../resources/images/Excel.png" />
   <p:dataExporter type="xls" target="grdAudit" fileName="ApplicationLog" />
</h:commandLink>

When I click the commandLink, I get the following exception error:

java.lang.NoClassDefFoundError: com/lowagie/text/DocumentException
at org.primefaces.component.export.PDFExporter.export(PDFExporter.java:45)
at org.primefaces.component.export.DataExporter.processAction(DataExporter.java:94)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:84)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:773)
at javax.faces.component.UICommand.broadcast(UICommand.java:296)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:783)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1248)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute
(InvokeApplicationPhase.java:77)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet
(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter
(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun
(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run
(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs
(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute
(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute
(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.lang.ClassNotFoundException: com.lowagie.text.DocumentException
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass
(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass
(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass
(ChangeAwareClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:305)
at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
at weblogic.utils.classloaders.GenericClassLoader.loadClass
(GenericClassLoader.java:179)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass
(ChangeAwareClassLoader.java:43)
... 29 more

Apparently, this class is missing: com.lowagie.text.DocumentException but I do not know how to get it, where to install it nor why the error is showing up. Any idea?

解决方案

  • iText-2.1.5.jar
  • poi-bin-3.7-20101029.zip

Download both and import it in your project and it will solve your error.

这篇关于从datatable导出数据使用2.0版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 01:36