14.01.2013 Views

Oracle JHeadstart Developer's Guide - Downloads - Oracle

Oracle JHeadstart Developer's Guide - Downloads - Oracle

Oracle JHeadstart Developer's Guide - Downloads - Oracle

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.

11.3. Runtime Implementation of National Language Support<br />

If you want to access a resource bundle in a JSF JSP page, you normally add a<br />

loadBundle tag to your page like this:<br />

<br />

And then you can access entries in this resource bundle like this:<br />

<br />

While this is a simple technique, the drawback is that you explicitly have to name your<br />

resource bundles in your page, and if you have multiple resource bundles, you need to<br />

include multiple tags, and you need to know which entry resides in<br />

which bundle.<br />

<strong>JHeadstart</strong> takes a slightly different approach. Instead of generating <br />

tags into the pages, <strong>JHeadstart</strong> generates a managed bean definition under the key nls<br />

which instantiates a class that provides access to all resource bundles of your application.<br />

In generated pages, you will often see references to this nls managed bean like this:<br />

<br />

This approach provides you with the flexibility to (re-)organize your resource bundles as<br />

you like, without the need to change the references to resource bundle entries in your<br />

page.<br />

In addition, this approach allows you to override <strong>JHeadstart</strong> and/or ADF Business<br />

Components messages. To do so, simply include the message key, for example JHS-<br />

00100 or JBO-27014 in one of your application resource bundles. If the key is not found in<br />

your default resource bundle(s), the standard <strong>JHeadstart</strong> or ADF BC message bundles<br />

are used.<br />

To make this all work, the following managed bean definitions are generated into the<br />

JhsCommon-beans.xml:<br />

11 - 10 Internationalization <strong>JHeadstart</strong> Developer’s <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!