Use JSTL tags in the portal JSPs

 


Overview

WebSphere Portal supports the use of tags from the JSP Standard Tag Library (JSTL), which originated from the Java Community Process to promote the adoption of common JSP tags that would be available in all compliant JSP containers.

Portal themes, skins, and screens can retrieve translated text by using the I18N tags from the JSTL. The I18N tag library is a subset of JSTL for handling issues of internationalization and translation. This method is preferred over using the <wps:text/> tag from the engine tag library, which is deprecated. The following tags from the I18N tag library are used to retrieve translated text:

<i18n:bundle/> Resource bundle for use by the other I18N tags.
<i18n:message/> Retrieves key from the bundle and writes the value to output.

When these I18N tags are used, the underlying getLocales() method of the HTTPServletRequest is overwritten to return the language preference in the user profile, if available. See Language determined by the portal for a complete description of how the language is selected.

Support for the JSTL tag library is provided by WebSphere Portal. To use the I18N tags, the following directive must be provided in the JSP.

<%@ taglib uri="/WEB-INF/tld/taglibs-i18n.tld" prefix="i18n" %>

The following example shows how the HTML help link in the toolbar can be created using the I18N tags for the link text.

<%-- help button --%>
<td class="wpsToolBar" valign="middle" align="<%=bidiAlignRight%>" nowrap="nowrap">
   <a class="wpsToolBarLink" href='<%= wpsDocURL %>/InfoCenter/help/index.html' target="...
        <i18n:bundle baseName="nls.engine">
           <i18n:message key="link.help"/>
        </i18n:bundle>
   </a>
</td>

Test this code by changing your language preference in the portal user profile and logging back in to the portal.

 

See also

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.