Java Reference
In-Depth Information
targetImage="mapImage" />
<bookstore:area id="map2" value="#{Book202}"
onmouseover="resources/images/book_202.jpg"
onmouseout="resources/images/book_all.jpg"
targetImage="mapImage"/>
...
</bookstore:map>
...
</h:form>
The alt attribute of the h:graphicImage tag maps to the localized string “ Choose
a Book from our Catalog ”.
The f:actionListener tag within the bookstore:map tag points to a listener
class for an action event. The processAction method of the listener places the topic
ID for the selected map area into the session map. The way this event is handled is ex-
plained more in “ Handling Events for Custom Components ” on page 119 .
The action attribute of the bookstore:map tag specifies a logical outcome String ,
bookstore ”, which by implicit navigation rules sends the application to the page
bookstore.xhtml . For more information on navigation, see the section “ Configuring
Navigation Rules on page 161 .
The immediate attribute of the bookstore:map tag is set to true , which indicates
that the default javax.faces.event.ActionListener implementation should
execute during the Apply Request Values phase of the request-processing lifecycle, in-
stead of waiting for the Invoke Application phase. Because the request resulting from
clicking the map does not require any validation, data conversion, or server-side object
updates, it makes sense to skip directly to the Invoke Application phase.
The current attribute of the bookstore:map tag is set to the default area, which is
map1 (the topic My Early Years: Growing Up on Star7 , by Duke).
Notice that the bookstore:area tags do not contain any of the JavaScript, coordinate,
or shape data that is displayed on the HTML page. The JavaScript is generated by the
dukesbookstore.renderers.AreaRenderer class. The onmouseover and
onmouseout attribute values indicate the image to be loaded when these events occur.
How the JavaScript is generated is explained more in “ Performing Encoding on page
109 .
The coordinate, shape, and alternate text data are obtained through the value attribute,
whose value refers to an attribute in application scope. The value of this attribute is a bean,
which stores the coords , shape , and alt data. How these beans are stored in the ap-
plication scope is explained more in the next section.
Search WWH ::




Custom Search