Use JSTL tags in the portal JSPs


WebSphere Portal supports the use of JSTL and Jakarta tags.

Portal themes, skins, and screens can retrieve translated text by using the I18N tags from the JSP Standard Tag Library (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. You can find information about the I18N tag library of the JSTL at

http://jakarta.apache.org/taglibs/doc/i18n-doc/intro.html.

The following tags from the I18N tag library are used to retrieve translated text:

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. For more information about these tags, see the I18N Tag Summary at http://jakarta.apache.org/taglibs/doc/i18n-doc/index.html#summary .

 

Set up the portal to support I18N tags from JSTL

This one-time procedure allows your portal to support I18N JSTL tags in themes, skins, and screens.

  1. Download the I18N tag library from the Jakarta Web site at the following address:

    http://cvs.apache.org/builds/jakarta-taglibs/nightly/projects/i18n/

  2. Extract taglibs-i18n.jar to the location of the portal server WPSLib shared library (wp_root/shared/app).

  3. Extract taglibs-i18n.tld to the location of the portal server tag definition declarations (wp_root/shared/app/WEB-INF/tld).

  4. From the WebSphere Application Server Administrative Console, update the application server class path with the name and location of the new JAR. Click Environment Then click Shared Libraries Then click WPSlib.

  5. Restart the portal server.

JSPs in the portal can now use the I18N JSP tags for retrieving translated text from resource bundles.

 

Use I18N tags in place of the engine text tag

The following steps show how to change the portal help icon to text using the I18N tags. Make sure that you have performed the setup steps.

  1. Make a backup copy of ToolBarInclude.jsp in the /themes directory.

  2. Edit ToolBarInclude.jsp.

  3. Find the markup for the help icon:
    
    <%-- help button --%>
    <td class="wpsToolBarIcon" valign="middle" align="<%=bidiAlignRight%>" nowrap>
       <a class="wpsToolBarLink" href='<%= wpsDocURL %>/InfoCenter/help/index.html' target=" ...
          <img border="0" align="absmiddle" width="16" height="16" src='<wps:urlFindInTheme  ...
       </a>
    </td>
    
    

  4. Replace the image tag with the following markup shown in bold.
    
    <%-- 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>
    
    
    

  5. Add the following directive near the top of Default.jsp
    
    <%@ taglib uri="/WEB-INF/tld/taglibs-i18n.tld" prefix="i18n" %> 
    
    

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

See also