Java Server Faces (JSF) 1.2 tidbits

Prior to version 1.2 of JavaServer Faces technology, page authors used the loadBundle tag to load a resource bundle into a page in order to reference localized data from a page. Page authors can still load resource bundles into a page using this method in version 1.2.

A new, more efficient way of loading resource bundles involves registering a resource bundle with the entire application by using a resource-bundle element in the application’s configuration file. The following resource-bundle element registers a ResourceBundle class named CustomMessages, which is in the resources package.

    <resource-bundle>
<var>customMessages</var>
<base-name>resources.CustomMessages</base-name>
</resource-bundle>

The var child element defines the name that page authors will use in expressions that reference the resource bundle, as shown here:

     <h:outputText value="#{customMessages.myText}" />

In this example, myText is the key that maps to the message in the resource bundle.

With the new resource-bundle element, you can load any number of resource bundles into the entire application. Not only does this new element eliminate the need to add a loadBundle tag to multiple pages, but it also has significant performance benefits because loading a resource bundle is an expensive operation.

source: http://java.sun.com/developer/technicalArticles/J2EE/jsf_12/

RK

Find Singapore Apartment  and Room Rentals here

Looking for a date or love? Click here to find one for free!!

Stock Market Views, Experiences on http://theindiastockmarket.blogspot.com/

This entry was posted in Technology and tagged , . Bookmark the permalink.

One Response to Java Server Faces (JSF) 1.2 tidbits

  1. Pingback: JSF message bundle VS Resource Bundle – wayneshare

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s