You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ivica Pavic <iv...@infodom.hr> on 2003/10/23 11:41:02 UTC
Charset Encoding problems with JSP Fragments (Tiles)
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 <%@page 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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Charset Encoding problems with JSP Fragments (Tiles)
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
On 10/23/2003 11:41 AM 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 <%@page 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?
Hi Ivica,
I upgraded to tomcat 5 recently partly because of this. If you use JSTL
fmt taglibs, then it's only in tomcat5 that uses JSTL 1.1 that things
are more manageable. You can specify it in the deployment descriptor for
various URLs, or by locale.
Adam
--
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Charset Encoding problems with JSP Fragments (Tiles)
Posted by Jason Lea <ja...@kumachan.net.nz>.
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 <%@page 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: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
--
Jason Lea
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org