How to use Character Encoding Filter together with ResponseOverrideFilter
Hallo
I have web application Struts/DisplayTag.
1.I need to use Charset Encoding Filter for encoding to UTF-8. And it works fine.
2.I need to use ResponseOverrideFilter for DisplayTag exports (http://displaytag.sourceforge.net/11/export_filter.html). And it works fine.
PROBLEM:
But I have problem if they are used together. The response is reseted by ResponseOverrideFilter and then CharsetEncoding Filter doesn't work correctly.
My code is:
Charset Encoding Filter:
publicclass CharsetFilterimplements Filter{
publicvoid init(FilterConfig config)throws ServletException{}
publicvoid destroy(){}
publicvoid doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException
{
request.setCharacterEncoding("UTF-8");
chain.doFilter(request,response);
}
}
Filters in web.xml:
<!-- Encoding Filterfor Struts (from'ISO-8859-1' to'utf8') -->
<filter>
<filter-name>Character Encoding</filter-name>
<filter-class>sk.stuba.fiit.kbase.CharsetFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Character Encoding</filter-name>
<servlet-name>action</servlet-name>
</filter-mapping>
<!-- Export filterfor DisplayTag (neededif you are using STRUTS) -->
<filter>
<filter-name>ResponseOverrideFilter</filter-name>
<filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ResponseOverrideFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>ResponseOverrideFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
Please, help me .....
Thanks in advance.

