Registering Custom Localized Static Text
Any custom localized static text you create that is not loaded into the page using the
loadBundletag must be registered with the application using theresource-bundleelement in the application configuration resource file in order for your pages to have access to the text. Likewise, any custom error messages that are referenced by theconverterMessage,requiredMessage, orvalidatorMessageattributes of an input component tag must also be made available to the application by way of theloadBundletag or theresource-bundleelement of the application configuration file.Here is the part of the file that registers some custom error messages for the Duke's Bookstore application:
<application> ... <resource-bundle> <base-name> com.sun.bookstore6.resources.CustomMessages </base-name> <var>customMessages</var> </resource-bundle> ... </application>Similarly to the loadBundle tag, the value of the
base-namesubelement specifies the fully-qualified class name of theResourceBundleclass, which in this case is located in theresourcespackage of the application.Also similarly to the
varattribute of theloadBundletag, hevarsubelement of theresource-bundleelement is an alias to theResourceBundleclass. This alias is used by tags in the page in order to identify the resource bundle.The
locale-configelement shown in the previous section also applies to the messages and static text identified by theresource-bundleelement. As with resource bundles identified by the message-bundle element, make sure that the resource bundle identified by theresource-bundleelement actually contains the messages for the locales that you specify with theselocale-configelement.To access the localized message, the page author uses a value expression to reference the key of the message from the resource bundle. See Performing Localization (page 390) for more information.