0

I am using struts2, spring3, hibernate for my Liferay portlat application.

I used Display Tag 1.2 version and download displaytag-portlet, displaytag,displaytag-export-poi.

I also created displaytag.properties file and also add following line in it.

factory.requestHelper=org.displaytag.portlet.PortletRequestHelperFactory.

All is running well. Pagination, display, sorting all running well. But if I put export="true" in <display:table> then it displays me link for convert pdf, csv, Excel, rtc ..

But when I clicked on any Link like CSV it will gives me an error.

08:15:32,191 ERROR [http-bio-8080-exec-17][render_portlet_jsp:154] Exception: [.TableTag] Unable to reset response before returning exported data. You are not using an export filter. Be sure that no other jsp tags are used before display:table or refer to the displaytag documentation on how to configure the export filter (requires j2ee 1.3). at org.displaytag.tags.TableTag.writeExport(TableTag.java:1538) at org.displaytag.tags.TableTag.doExport(TableTag.java:1454) at org.displaytag.tags.TableTag.doEndTag(TableTag.java:1309) at org.apache.jsp.pages.pim.employee.searchEmployee_jsp._jspService(searchEmployee_jsp.java:509) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

What is the solution for this?

I also add filter in web.xml like:

<filter>
<filter-name>ResponseOverrideFilter</filter-name>
<filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>ResponseOverrideFilter</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping> 

<filter-mapping>
<filter-name>ResponseOverrideFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>   
4

2 回答 2

1

我能想到两种解决方案

  1. 安德里亚所说的在 web.xml 中的 struts2 过滤器之前添加这行代码

    <filter>
      <filter-name>ResponseOverrideFilter</filter-name>
      <filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>
    </filter>
    
  2. 如果您使用多个表,请增加 JSP 的页面缓冲区大小

     <%@ page buffer = "16kb" %>
    

您可以尝试将缓冲区大小增加到 32kb 或 64kb 并检查它是否有效。

于 2015-04-29T08:10:46.833 回答
0

错误可能在web.xml你没有写的那部分。

我猜你可能已经宣布

  • Struts2 StrutsPrepareAndExecuteFilter(如果 S2 版本 < 2.1.x,则为FilterDispatcher )
  • DisplayTag ResponseOverrideFilter

在这种情况下,顺序是错误的,您只需将 DisplayTag 过滤器放在Struts2 过滤器之前。

于 2013-07-01T12:18:25.167 回答