You also use the contentType attribute to specify the encoding of the response. For example, the date application specifies that the page should be encoded using UTF-8, an encoding that supports almost all locales, using the following page directive:
<%@ page contentType="text/html; charset=UTF-8" %>
If the response encoding weren’t set, the localized dates would not be rendered correctly.
<%@ page pageEncoding="UTF-8" %>
You can also set the page encoding of a set of JSP pages. The value of the page encoding varies depending on the configuration specified in the JSP configuration section of the web application deployment descriptor (see Declaring Page Encodings).