display标签的使用t required libraries are missing: com/lowagie/text/Element

近期在我的项目中使用了display标签,原本以为特别容易,用起来就有错了:

在使用display标签的时候后台报错如下:

2011-03-22 19:03:47,224 org.displaytag.export.ExportViewFactory.<init>(ExportViewFactory.java:61) INFO [org.displaytag.export.ExportViewFactory] - <Initializing ExportViewFactory with type={csv,excel,xml,pdf,rtf}>

2011-03-22 19:03:47,268 org.displaytag.export.ExportViewFactory.registerExportView(ExportViewFactory.java:105) WARN [org.displaytag.export.ExportViewFactory] - <Unable to instantiate class for pdf export. org.displaytag.export.PdfView was found, but required libraries are missing: com/lowagie/text/Element>

2011-03-22 19:03:47,302 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704) ERROR [StandardWrapper[/tyut:jsp]] - <Servlet.service() for servlet jsp threw exception>

java.lang.NullPointerException

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:164)

at org.displaytag.util.ReflectHelper.classForName(ReflectHelper.java:43)

at org.displaytag.export.ExportViewFactory.registerExportView(ExportViewFactory.java:95)

at org.displaytag.export.JspServlet.service(JspServlet.java:241)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

经过查看官方文档,知道:

     If you would like to make use of the display taglib in your own application, do the following:

  1. Drop the displaytag-version.jar file in your application WEB-INF/lib directory
  2. Make sure that following libraries are in your WEB-INF/lib directory (or made available via the classpath to your application server). Refer to the dependencies document for the correct version of these libraries. You can download a copy of everything from jakarta or you can grab them from the example webapp in the bin distribution. The following is the list of dependencies:
    • commons-logging
    • commons-lang
    • commons-collections
    • commons-beanutils
    • log4j
    • itext (optional, for pdf/rtf export)

    You may want to include also the displaytag-export-poi jar, which adds an excel binary export using jakarta POI. The poi jar is required by displaytag-export-poi

  3. Optional. Depending on your architecture, you may need to configure a filter to make export work. See the export filter page for the details about how to do it and when you could need it. 缺少itext.jar就会报上面的错。所以我加了itext-1.4.jar,重新启动项目,ok
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值