Tutorial 7.3: Deploy a Portlet
In this tutorial, you will install the portlets you built in Tutorials 7.1 and 7.2 in IBM WebSphere Portal. You will then add the portlets to portal pages and set permissions for the portlets.
Step 1 shows you how to install a portlet in a production machine/environment performed by an administrator. If you want to do additional testing in a test machine/environment first with WebSphere Portal installed, you can deploy directly from WebSphere Portlet factory using a deployment configuration. Remaining steps on adding a portlet to a portal page or setting access permissions are the same.
Step 1: Install a Portlet in IBM WebSphere Portal
In this step, you will install the portlets to WebSphere Portal.
- Log in to WebSphere Portal.
- Start the WebSphere_Portal server if it is not already running.
- Open a browser and enter the URL http://<hostname>:<port_number>/wps/portal, where <hostname> is the fully qualified host name of the machine that is running your WebSphere Portal, and <port_number> is the port number displayed on the confirmation panel during your install. For example, enter http://portalhost.ibm.com:10040/wps/portal
- Log in using your WebSphere Portal administrator user ID and password.
Install the portlets.
- Click Administration at the top of the page as shown in Figure 7.69.
Figure 7.69 Select WebSphere Portal administration
- In the left pane, click Portlet Management, Web Modules as shown in Figure 7.70.
Figure 7.70 Portlet management
- On the Manage Web Modules page, click Install as shown in Figure 7.71.
Figure 7.71 Manage Web modules
The Installing a Web Module Wizard appears. In step 1 of the wizard as shown in Figure 7.72, browse to the build path that you specified when you built the portlet WAR. Select PA_PetTravel.war. Click Next.
Figure 7.72 Step 1 of Installing a Web Module Wizard
For example: browse to C:\Documents and Settings\Administrator\workspace\PetTravel\PA_PetTravel.war.
- In Step 2 of the wizard as shown in Figure 7.73, review the portlets that are going to be installed. You should see the two portlets that you created. Click Finish.
Figure 7.73 Step 2 of Installing a Web Module Wizard
- Once the installation is complete, a message indicating that the installation was successful is shown at the top of the page as in Figure 7.74.
Figure 7.74 Portlet successfully installed
- Click Administration at the top of the page as shown in Figure 7.69.
- To verify the installation, search by File Name Contains and enter PetTravel as the search criteria. You should see PA_PetTravel.war in the list of Web modules as shown in Figure 7.75.
Figure 7.75 Verify portlet installation
In this step, you have installed the portlet application that was developed using WebSphere Portlet Factory.
Step 2: Add a Portlet to a WebSphere Portal Page
In the previous step, you installed the portlets. They will not appear in the portal site yet. They need to be added to portal pages. In this step, you will create a portal page and add the two portlets to the portal page.
- Create a portal page.
- You should still be in the Administration page. In the left pane, click Portal User Interface, Manage Pages as shown in Figure 7.76.
Figure 7.76 Manage pages
- On the Manage Pages page, click Content Root. When you are at Content Root, click Home. Click New Page to create a new page under Home as shown in Figure 7.77.
Figure 7.77 Create new page
- Enter Pet Travel for the title as shown in Figure 7.78. Click OK.
Figure 7.78 Page properties for new page
- You should see Pet Travel in the list of pages as shown in Figure 7.79.
Figure 7.79 Verify page creation
- Select Home, and you will see the Pet Travel page.
- You should still be in the Administration page. In the left pane, click Portal User Interface, Manage Pages as shown in Figure 7.76.
- Add portlets to a portal page.
- Click the Page Menu icon and click Edit Page Layout as shown in Figure 7.80.
Figure 7.80 Launch page menu
- Click Add Portlets in the left column in the layout as shown in Figure 7.81.
Figure 7.81 Edit layout
- A search screen renders on the page to let you search for the portlet you want to add. Search by Title Contains and enter PetTravel as the search criteria as shown in Figure 7.82.
Figure 7.82 Search for portlet
- In the search results, select the check box for both ListPetTravelCompany and PetTravelInfo as shown in Figure 7.83. Click OK.
Figure 7.83 Select portlet
-
ListPetTravelCompany and PetTravelInfo appear in the left column of the layout page as shown in Figure 7.84. Click the down arrow to the right of ListPetTravelCompany to move it below PetTravelInfo. Click Done.
Figure 7.84 Portlet added
- Click the Page Menu icon and click Edit Page Layout as shown in Figure 7.80.
- Your two portlets appear in the portal site as shown in Figure 7.85.
Figure 7.85 Portlets added to home page
In this step, you have added the two portlets to a portal page. They now appear in the portal site.
Step 3: Access a Portlet as a New User
In this step, enroll in WebSphere Portal as a new user by filling out your own profile information; then log into Portal using the new ID.
- Sign up as a new WebSphere Portal user.
- Open a browser and enter the URL http://<hostname>:<port_number>/wps/portal where <hostname> is the fully qualified host name of the machine that is running your WebSphere Portal, and <port_number> is the port number. For example, enter http://portalhost.ibm.com:10040/wps/portal.
- Click the Sign Up link above the Log In button.
- Fill in your user profile information to enroll in WebSphere Portal. You can choose your own user ID in Portal. In the example that follows as shown in Figure 7.86, the User ID registered is Mary. Click OK.
Figure 7.86 Sign up as new user in WebSphere Portal
- A message is displayed saying the user was created successfully.
- Log in to Portal using the newly created user Mary.
- Do you see the two portlets on the Pet Travel page? The portlets are not on user Mary's Pet Travel page. When you installed the portlets in WebSphere Portal, you did not grant users with access permission to the portlets. That is why you can only view the portlets as the administrator. No other users can view them at this point.
- Exit WebSphere Portal by clicking Log Out in the upper-right corner.
In this step, you logged in as a new user and were not able to access the portlets because you have not been granted access yet.
Step 4: Set Access Permissions for a Portlet
In this step, all authenticated portal users will be granted access to the portlets.
- Go to the administrative function for setting permissions for portlets. Grant users access to the newly installed portlets.
- Log in to the WebSphere Portal as the Administrator again.
- Click Administration at the top of the page.
- Click Access, Resource Permissions.
- Grant users access to the newly installed portlets.
- In the Resource Permissions page, as shown next in Figure 7.87, click Portlets.
Figure 7.87 Resource Permissions page
- Search by Title Contains and enter PetTravel as the search criteria.
- Click the Assign Access icon displayed beside the PetTravelInfo resource as shown in Figure 7.88.
Figure 7.88 Assign Access
- Click the Edit Role icon beside the User role as shown in Figure 7.89.
Figure 7.89 Modify access for a role
- There are currently no members in this role, as shown next in Figure 7.90. This explains why you weren't able to see the PetTravelInfo portlet when you logged in as a user who is not an administrator (for example, Mary). Click Add to add members to this role.
Figure 7.90 Members with access are shown
- Select the All Authenticated Portal Users check box. Click OK.
- In the Resource Permissions page, as shown next in Figure 7.87, click Portlets.
- Log out of Portal, and log in as a user who is not an administrator. For example, log in as Mary.
- What do you see in the Pet Travel page? You should see PetTravelInfo but not ListPetTravelCompany as shown in Figure 7.91. You have granted users access to the PetTravelInfo portlet but have not done that for the ListPetTravelCompany portlet yet.
Figure 7.91 PetTravelInfo accessible by all users
In this step, you set access permissions to the portlet PetTravelInfo and confirmed that all portal users now have access to the portlet.