130 IBM WebSphere Everyplace Access V5, Volume II: Application Development
<B><%= request.getAttribute("MyMessage") %></B>
<% } %>
</DIV>
Example 4-23 MessageReceiverView.jsp (Br Portuguese)
<%@ page contentType="text/html" import="java.util.*, messagereceiver.*"%>
<%@ taglib uri="/WEB-INF/tld/portlet.tld" prefix="portletAPI" %>
<portletAPI:init/>
<DIV style="margin: 6px">
<H3 style="margin-bottom: 3px">Welcome!</H3>
This is a sample <B>view mode</B> page. You have to edit this page to customize
it for your own use.<BR>
The source file for this page is "/Web
Content/messagereceiver/jsp/html/pt_BR/MessageReceiverView.jsp".
<br>
<% if (request.getAttribute("MyMessage") == null) { %>
<B>Pronto para receber mensagem ...</B>
<% } else { %>
<B>Mensagem recebida:</B>
<B><%= request.getAttribute("MyMessage") %></B>
<% } %>
</DIV>
8. Run the scenario (click Run on Server) and verify your results in multiple
languages.
9. Change the locale in the user profile as before and try other supported
languages.
4.7.1 Adding PDA markup support
Follow these step to add PDA markup support by translating and maintaining
separate JSPs:
1. Create a new folder with the name pda. Create folders into pda folder for each
languages you want to support such as English (en), Spanish (es) and
Brazilian Portuguese (pt_BR).
2. In the PDA directories, include the corresponding JSP files for each language
folder. You can create new files or copy from the html directories. Don’t forget
to display a message in the proper language for each JSP file. See 4.7,
Chapter 4. National Language Support (NLS) 131
“Sample scenario: translating whole resources” on page 125 for more details.
Your directory structure should be as illustrated in Figure 4-43.
Figure 4-43 Directory structure
3. Update the portlet.xml file to indicate it supports PDA markup. For each
portlet, add a markup name of pda to the support tags in the portlet.xml file.
Example 4-24 portlet.xml file
......
<portlet-app-name>ActionEvent application</portlet-app-name>
<portlet id="actionevent.ActionEventPortlet"
href="WEB-INF/web.xml#actionevent.ActionEventPortlet" major-version="1"
minor-version="0">
<portlet-name>ActionEvent portlet</portlet-name>
<cache>
<expires>0</expires>
<shared>no</shared>
</cache>
<allows>
<maximized />
<minimized />
132 IBM WebSphere Everyplace Access V5, Volume II: Application Development
</allows>
<supports>
<markup name="pda">
<view />
<edit />
</markup>
<markup name="html">
<view />
<edit />
</markup>
</supports>
</portlet>
<portlet id="messagereceiver.MessageReceiver"
href="WEB-INF/web.xml#messagereceiver.MessageReceiver" major-version="1"
minor-version="0">
<portlet-name>MessageReceiver portlet</portlet-name>
<cache>
<expires>0</expires>
<shared>no</shared>
</cache>
<allows>
<maximized />
<minimized />
</allows>
<supports>
<markup name="pda">
<view />
</markup>
<markup name="html">
<view />
</markup>
</supports>
</portlet>
</portlet-app>
......
4. Select File -> Save All to save all your changes to the project.
5. Run the NLS scenario.
Chapter 4. National Language Support (NLS) 133
Figure 4-44 Running sample scenario in PDA
Note: For more information about adding PDA markup support, refer to the
WebSphere Everyplace Access InfoCenter documentation.
134 IBM WebSphere Everyplace Access V5, Volume II: Application Development

Get IBM WebSphere Everyplace Access V5 Handbook for Developers and Administrators Volume II: Application Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.