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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Using Custom Objects<br />

374<br />

<br />

<br />

...<br />

<br />

Using a Custom Component<br />

In order to use a custom component in a page, you need to declare the tag library that defines<br />

the custom tag that renders the custom component, as explained in “Using Custom Objects” on<br />

page 371, and you add the component’s tag to the page.<br />

<strong>The</strong> Duke’s Bookstore application includes a custom image map component on the<br />

chooselocale.jsp page. This component allows you to select the locale for the application by<br />

clicking on a region of the image map:<br />

...<br />

<br />

<br />

<br />

...<br />

<br />

<br />

<strong>The</strong> standard graphicImage tag associates an image (world.jpg) with an image map that is<br />

referenced in the usemap attribute value.<br />

<strong>The</strong> custom map tag that represents the custom component, MapComponent, specifies the image<br />

map, and contains a set of area tags. Each custom area tag represents a custom AreaComponent<br />

and specifies a region of the image map.<br />

On the page, the onmouseover and onmouseout attributes specify the image that is displayed<br />

when the user performs the actions described by the attributes. <strong>The</strong> page author defines what<br />

these images are. <strong>The</strong> custom renderer also renders an onclick attribute.<br />

<strong>The</strong> <strong>Java</strong> <strong>EE</strong> 5<strong>Tutorial</strong> • June 2010

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

Saved successfully!

Ooh no, something went wrong!