Common mistake using include directive with non ISO-8859-1 in JSP 1.2

Technote (FAQ)
Problem
Each JavaServer Page™ (JSP™) using the JSP 1.2 standard must have charset defined to support code pages other than the ISO-8859-1 code page.
Solution
Each JSP file must have charset defined so code pages other than ISO-8859-1 are supported in JSP 1.2.

Example

In main.jsp, main is translated as ISO-8859-1, even though the included JSP page defines charset as ISO-8859-2.


main.jsp:
<%@include file="sub.jsp"%>
<h1>Main</h1>

sub.jsp:
<%@ page contentType="text/html; charset=ISO-8859-2" %>
<h2>Sub</h2>

How this works

  1. The main JSP file is translated based on default encoding ISO-8859-1.

  2. When the static include is processed, the included JSP, sub.jsp, uses the ISO-8859-2 code page.

  3. The results of processing sub.jsp are embedded the code into main.jsp.

  4. After the include is processed, encoding uses code page ISO-8859-1 again.











Document Information

Product categories: Software, Application Servers, Distributed Application & Web Servers, WebSphere Application Server, JSP
Operating system(s): Multi-Platform
Software version: 3.5, 4.0, 5.0, 5.1, 6.0
Software edition: Edition Independent
Reference #: 1179410
IBM Group: Software Group
Modified date: 2004-09-14