Using special components
The RichFaces component library includes a number of special-purpose components that can be used to enhance the functionality of an existing JSF application. Some examples of these include the RichFaces HtmlGmap
and HtmlVirtualEarth
components, which render a Google Maps object and a Microsoft Virtual Earth object respectively.
Rendering a Google Maps object
The<rich:gmap>
tag can be used to render a Google Maps object on our JSF page. This tag can be combined with Ajax4jsf tags to integrate the Google map with custom JavaScript functions and JSF backing bean data.
In this example, we will be using the JavaScript Object Notation (JSON) to transfer data between our JSF application and web browser. Ajax4jsf supports this data transfer format and automatically serializes our Java objects into JSON data structures.
To begin, we write a new Java class named Location
that will encapsulate the geographic information needed to display different locations on the...