Home > Articles > Web Services > WebSphere

  • Print
  • + Share This
This chapter is from the book

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.

  1. Log in to WebSphere Portal.
    1. Start the WebSphere_Portal server if it is not already running.
    2. 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
    3. Log in using your WebSphere Portal administrator user ID and password.
  2. Install the portlets.

    1. Click Administration at the top of the page as shown in Figure 7.69.
      Figure 7.69

      Figure 7.69 Select WebSphere Portal administration

    2. In the left pane, click Portlet Management, Web Modules as shown in Figure 7.70.
      Figure 7.70

      Figure 7.70 Portlet management

    3. On the Manage Web Modules page, click Install as shown in Figure 7.71.
      Figure 7.71

      Figure 7.71 Manage Web modules

    4. 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

      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.

    5. 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

      Figure 7.73 Step 2 of Installing a Web Module Wizard

    6. 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

      Figure 7.74 Portlet successfully installed

  3. 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

    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.

  1. Create a portal page.
    1. 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

      Figure 7.76 Manage pages

    2. 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

      Figure 7.77 Create new page

    3. Enter Pet Travel for the title as shown in Figure 7.78. Click OK.
      Figure 7.78

      Figure 7.78 Page properties for new page

    4. You should see Pet Travel in the list of pages as shown in Figure 7.79.
      Figure 7.79

      Figure 7.79 Verify page creation

    5. Select Home, and you will see the Pet Travel page.
  2. Add portlets to a portal page.
    1. Click the Page Menu icon and click Edit Page Layout as shown in Figure 7.80.
      Figure 7.80

      Figure 7.80 Launch page menu

    2. Click Add Portlets in the left column in the layout as shown in Figure 7.81.
      Figure 7.81

      Figure 7.81 Edit layout

    3. 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

      Figure 7.82 Search for portlet

    4. In the search results, select the check box for both ListPetTravelCompany and PetTravelInfo as shown in Figure 7.83. Click OK.
      Figure 7.83

      Figure 7.83 Select portlet

    5. 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

      Figure 7.84 Portlet added

  3. Your two portlets appear in the portal site as shown in Figure 7.85.
    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.

  1. Sign up as a new WebSphere Portal user.
    1. 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.
    2. Click the Sign Up link above the Log In button.
    3. 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

      Figure 7.86 Sign up as new user in WebSphere Portal

    4. A message is displayed saying the user was created successfully.
  2. Log in to Portal using the newly created user Mary.
  3. 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.
  4. 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.

  1. Go to the administrative function for setting permissions for portlets. Grant users access to the newly installed portlets.
    1. Log in to the WebSphere Portal as the Administrator again.
    2. Click Administration at the top of the page.
    3. Click Access, Resource Permissions.
  2. Grant users access to the newly installed portlets.
    1. In the Resource Permissions page, as shown next in Figure 7.87, click Portlets.
      Figure 7.87

      Figure 7.87 Resource Permissions page

    2. Search by Title Contains and enter PetTravel as the search criteria.
    3. Click the Assign Access icon displayed beside the PetTravelInfo resource as shown in Figure 7.88.
      Figure 7.88

      Figure 7.88 Assign Access

    4. Click the Edit Role icon beside the User role as shown in Figure 7.89.
      Figure 7.89

      Figure 7.89 Modify access for a role

    5. 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

      Figure 7.90 Members with access are shown

    6. Select the All Authenticated Portal Users check box. Click OK.
  3. Log out of Portal, and log in as a user who is not an administrator. For example, log in as Mary.
  4. 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

    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.

  • + Share This
  • 🔖 Save To Your Account