10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

A registry of content type names is kept by the IANA at http://www.iana.org/assignments/<br />

media-types/.<br />

Response and Page Encoding<br />

You also use the contentType attribute to specify the encoding of the response. For example,<br />

the date application specifies that the page should be encoded using UTF-8, an encoding that<br />

supports almost all locales, using the following page directive:<br />

<br />

If the response encoding weren’t set, the localized dates would not be rendered correctly.<br />

To set the source encoding of the page itself, you would use the following page directive:<br />

<br />

You can also set the page encoding of a set of JSP pages. <strong>The</strong> value of the page encoding varies<br />

depending on the configuration specified in the JSP configuration section of the web<br />

application deployment descriptor (see “Declaring Page Encodings” on page 179).<br />

Creating Dynamic Content<br />

You create dynamic content by accessing <strong>Java</strong> programming language object properties.<br />

Using Objects within JSP Pages<br />

You can access a variety of objects, including enterprise beans and <strong>Java</strong>Beans components,<br />

within a JSP page. JSP technology automatically makes some objects available, and you can also<br />

create and access application-specific objects.<br />

Using Implicit Objects<br />

Creating Dynamic Content<br />

Implicit objects are created by the web container and contain information related to a particular<br />

request, page, session, or application. Many of the objects are defined by the <strong>Java</strong> servlet<br />

technology underlying JSP technology and are discussed at length in Chapter 4, “<strong>Java</strong> Servlet<br />

Technology.” <strong>The</strong> section “Implicit Objects” on page 161 explains how you access implicit<br />

objects using the JSP expression language.<br />

Chapter 5 • <strong>Java</strong>Server PagesTechnology 145

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!