12.3. JSR 168 API considerations

In this section you will see how to access resource bundles in Portlets JSR 168, from JSPs and from portlets.

If you want to access resource bundles in JSPs, you have to use the JSP tag library as we explained in “Accessing resource bundles in JSPs” on page 382.

To access resource bundles in Portlets JSR 168 use getResourceBundle(java.util.Locale) method of javax.portlet.GenericPortlet class as displayed in Example 12-8

Example 12-8. Accessing resource bundles in Portlets JSR 168
ResourceBundle resource =
      getPortletConfig().getResourceBundle(request.getLocale());
String valor = resource.getString("welcome");

The name of the resource bundles where the information is stored is provided by the portlet deployment ...

Get IBM Rational Application Developer V6 Portlet Application Development and Portal Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.