使用 primefaces 2.0 从数据表导出数据
我有一个页面,将一些数据加载到数据表中,并提供三个按钮用于导出到 pdf、xls 和 csv。我使用了 Primefaces 在其网页中相同的示例代码:
<h:commandLink>
<p:graphicImage value="../resources/images/Excel.png" />
<p:dataExporter type="xls" target="grdAudit" fileName="ApplicationLog" />
</h:commandLink>
当我单击 commandLink 时,我收到以下异常错误:
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
显然,此类丢失:com.lowagie.text.DocumentException 但我不知道如何获取它,在哪里安装它以及为什么会出现错误。有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,primefaces 2.2.1 的用户指南第 12 页指出,您需要特定版本的 POI 和 iText 库才能导出。下载正确的版本并将其包含在项目中后,导出应该可以进行。
First, the user's guide of primefaces 2.2.1 says on page 12 that you need a specific versions of the POI and iText libraries for the exporting. After you have downloaded the correct versions and include them in the project, the exporting should work.
下载这两个文件并将其导入到您的项目中,它将解决您的错误。
Download both and import it in your project and it will solve your error.