views:

54

answers:

1

Hello,

I am using Spring 3.0.3 + sitemesh + JSP and I am experiencing troubles with encoding of result page.

I have used Spring's CharacterEncodingFilter to encode response and request with UTF-8, I have stated in JSTLViewResolver appropriate contentType. I also have saved my jsp's and tag's in UTF-8 format.

What I would really want to avoid is stating at every jsp and tag file directive with pageEncoding like

<%@ tag pageEncoding='UTF' %>

Is there a way to avoid that?

Thanks

A: 

Short answer, no. For the jsps you could put the page declaration in a file, say includes.inc, and then include that file in all jsps:

<%@ include file="includes.inc"%>

In theory that should work, and it works for other things that you put there, but it seems that if specifying the charset in an included file, Tomcat doesn't get it (defaults to ISO-8859-1). If this technique works for your specific server installation, than use it.

Victor Ionescu