JSF PrimeFaces将数据表导出到excel

时间:2015-04-07 08:27:02

标签: jsp jsf servlets primefaces datatables

我正在尝试使用primefaces.except将数据导出到excel,pdf,csv,xml文档。除了excel之外,其他三种格式正在运行,文件正在下载。

我的代码:

<h:form>

            <h:commandLink>
                <p:graphicImage value="../resources/images/excel_png.png" />
                <p:dataExporter type="xls" target="usersData" fileName="users" excludeColumns="4" />
            </h:commandLink>

            <h:commandLink>
                <p:graphicImage value="../resources/images/pdf_png.png" />
                <p:dataExporter type="pdf" target="usersData" fileName="users" excludeColumns="4" />
            </h:commandLink>

            <h:commandLink>
                <p:graphicImage value="../resources/images/csv_png.png" />
                <p:dataExporter type="csv" target="usersData" fileName="users" excludeColumns="4" />
            </h:commandLink>

            <h:commandLink>
                <p:graphicImage value="../resources/images/xml_png.png" />
                <p:dataExporter type="xml" target="usersData" fileName="users" excludeColumns="4" />
            </h:commandLink>

            </h:form>

例外:

Apr 07, 2015 1:49:53 PM com.sun.faces.lifecycle.Phase doPhase
SEVERE: JSF1054: (Phase ID: RESTORE_VIEW 1, View ID: ) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@23573402]
Apr 07, 2015 1:49:53 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/JPAtrailOne] threw exception [viewId:/Total.jsp - View /Total.jsp could not be restored.] with root cause
javax.faces.application.ViewExpiredException: viewId:/Total.jsp - View /Total.jsp could not be restored.
    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:185)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:103)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1086)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:659)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1558)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1515)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

0 个答案:

没有答案