9.3.5 Updating the portlet descriptor (portlet.xml)

In this section, you will update the portlet descriptor (portlet.xml) to do the following:

Add three primary colors as preferences

You will also add the .greeting preference

Execute the following steps:

1. Open the portlet.xml by double-clicking the Portlet Deployment Descriptor in your project.

2. Select the Portlets tab and then select MySimplePortlet as seen in Figure 9-23.

Figure 9-23 Portlet.xml

3. Scroll down until you see the Persistent Preference Store box as shown in Figure 9-24.

4. Clear all preferences as follows:

a. Select all the preferences by holding down Ctrl and selecting each preference.

b. Select Remove.

Figure 9-24 Persistent Preference Store

5. You will now add the preferences for the .greeting, red, yellow, and blue. For the .greeting, you will mark it as read-only.

Read only means that only an administrator in Configuration mode will be able to update this preference during runtime.

Execute the following steps:

a. Select Add to open the New Preference window.

b. Enter .greeting for the name.

c. Select Add to enter a value of Hello.

d. For the .greeting preference only: check the box for read-only.

e. Select OK.

f. Repeat steps a through e for the three colors (red, yellow, and blue). Use lower case for the color names and values. Do not select the read-only option for these preferences.

Figure 9-25 New Preference window

g. Save and close the portlet.xml by using Ctrl-s or File | Save.

Note: There should not be any errors in any of the files.

6. Examine the portlet descriptor (portlet.xml) source and review the preferences you just entered.

Redbooks
ibm.com/redbooks