近期在我的项目中使用了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:
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