27.3.1 Importing the Echo portlet

Follow these steps to import the Echo portlet:

1. Select File | Import. In the import panel, select the WAR file and click Next.

2. In the next window, enter the following information:

a. WAR file: browse to C:\LabFiles\Struts Cooperative Portlets\Echo.war

b. Web project: enter EchoTarget

c. Target server: select WebSphere Portal V5.1

d. Select Add module to an EAR project

e. EAR project: EchoTargetEAR

3. Click Finish.

The EchoSource and EchoTarget portlet applications use the same UID so it will cause an error executing the portlets. To fix this problem expand EchoTarget/WebContent/WEB-INF folder and open the portlet deployment descriptor file (portlet.xml). In the portlet deployment descriptor editor, select Source panel, change the last digit of the UID for this portlet application and save your changes.

For example, in this sample scenario, the last digit was 0 and it was changed to 1, as highlighted in Example 27-6.

Example 27-6 Changing a digit in portlet application ID

<?xml version="1.0" encoding="UTF-8"?>
<portlet-app
 xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
 version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
 id="echo.EchoPortlet.0190a47431">
 <portlet>
 .....
 </portlet>
</portlet-app>

It is recommended that you change the portlet title to identify each portlet when they will be on the same page. Follow these steps for each resource bundle:

1. Open the resource bundles (EchoPortletResource properties file), located in the EchoTarget/Java Resources/JavaSource/echo.nl directory.

2. Add a title in the line javax.portlet.title. For example:
javax.portlet.title=Echo Target portlet

3. Save the file.

Redbooks
ibm.com/redbooks