I have had a similar experience with Tomcat 4.1.*. Though I seem to remember that putting this

<%@ page contentType="text/html; charset=UTF-8"%>

In the tiles layout page worked if Tomcat compiled the pages. But if I pre-compiled the jsp tiles it wouldn't work.
My guess was that when pre-compiling each page is given to the compiler and the content type is read from the page, but if it is included when Tomcat compiles a page it takes the content type from the parent page.


That means to pre-compile I have had to add <%@ page contentType="text/html; charset=UTF-8"%> to every jsp page. So normally I have this at to top of each page:

<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/WEB-INF/jsp/include/global.jsp" %>

and I stick everything else that is needed on everypage into global.jsp - such as taglibs. Putting the content type into global didn't work when pre-compiling either.


Ivica Pavic wrote:


I'm trying to set the UTF-8 charset for the whole application. I'm using Struts/Tiles on Tomcat 4.1.27. For now the only way to achieve this was adding <[EMAIL PROTECTED] contentType="text/html; charset=utf-8"%> on EVERY Tile (JSP). It's a lot of copy/paste job and I'm sure there should be a more elegant way. I've tried several things:
1. Setting the controller contentType to "text/html; charset=UTF-8" in struts-config.xml
2. Adding <%request.setCharacterEncoding("UTF-8");%> in the master layout
3. Adding <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> to Master layout's <HEAD>
BUT NOTHING WORKS except adding a page directive on every JSP fragment.
Anyone has that resolved?


Ivica




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]






--
Jason Lea




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to