Download FAQ History |  | API Search Feedback

> ## Creating Static Content

> You create static content in a JSP page by simply writing it as if you were creating a page that consisted only of that content. Static content can be expressed in any text-based format, such as HTML, WML, and XML. The default format is HTML. If you want to use a format other than HTML, you include a `page` directive with the `contentType` attribute set to the content type at the beginning of your JSP page. The purpose of the `contentType` directive is to allow the browser to correctly interpret the resulting content. So, if you want a page to contain data expressed in the wireless markup language (WML), you need to include the following directive:

>     <%@ page contentType="text/vnd.wap.wml"%>

> A registry of content type names is kept by the IANA at:

>     http://www.iana.org/assignments/media-types/

> ### Response and Page Encoding

> 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, with 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.

> To set the source encoding of the page itself, you would use the following `page` directive.

>     <%@ 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`)`.

Download FAQ History |  | API Search Feedback

All of the material in The Java(TM) Web Services Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.