SAS 9.1.3 Integration Technologies » SAS Web Infrastructure Kit: Developer's Guide


Developing Custom Portlets
Development Steps
Creating a Deployment Descriptor
Creating Display Resources Files
Developing the Presentation JSP Page
Creating Action Classes
Implementing Portlet Help
Creating a PAR File
Use Cases
Simple Display Portlet
Localized Portlet
Portlet Template (Editable Portlet)
Remote Portlet
Tips and Best Practices
Using the Portlet API
Sample Portlets
Localized Display Portlet (Welcome)
Interactive Form Portlet (FormExample)
Portlet Template, or Editable Portlet (DisplayURL)
Web Application (HelloUserWikExample)
Remote Portlet (HelloUserRemote
Portlet
Sample: Portlet Template, or Editable Portlet (DisplayURL)

Step 5: Create the Resource Bundle

The resource bundles provide translated text to be displayed inside the DisplayURL portlet. The portlet's BaseAction, EditorAction, and ErrorHandler classes call the NavigationUtil.prepareLocalizedResources() method to create a JSTL localization context based on the user's locale preference. This context enables the JSTL tags in the portlet's JSP pages to use the appropriate resource bundle to display text.

For more information about creating resource bundles, see Creating a Localized Portlet.

Note: For information about localizing a portlet's title and description, see Creating Display Resources Files.

One resource bundle is provided with the DisplayURL portlet, as follows.

Note: If you copy and paste this code, then you must remove the line breaks in the message strings for error.msg1.txt and viewer.nourl.txt.


# Messages for the DisplayURL portlet

# NOTE: this is the same message text as found in
#       com.sas.portal.res.Resources.properties. The localized versions
#       from there can be used here.
error.msg1.txt=A serious error occurred. Contact the Portal 
     administrator.

# {0} will be a URL. {1} will be an exception message.
viewer.badurl.fmt=Unable to display ''{0}'' because ''{1}''.
viewer.nourl.txt=No URL has been specified. Please edit the portlet to 
     set a URL.

editor.task.txt=Enter the URL of the HTML fragment to display.
editor.url.txt=URL:

# NOTE: these are the same messages as found in
#       com.sas.portal.res.Resources.properties. The localized versions
#       from there can be used here.
editor.action.cancel.txt=Cancel
editor.action.ok.txt=OK