You are on page 1of 41

Hello World: WebSphere Portal V6

Develop, test, and deploy MyFirstPortlet


Skill Level: Intermediate Laura Chan (laurac@ca.ibm.com) Software Developer IBM Janet Lee (janetlee@ca.ibm.com) Software Engineer IBM

04 Apr 2007 Get an overview of WebSphere Portal in this basic tutorial, which includes both demos and hello world exercises. This tutorial includes two practical exercises. You will develop and test your first portlet using Rational Application Developer with the WebSphere Portal Test Environment. Then, you'll deploy your portlet in a production environment using WebSphere Portal.

Section 1. Before you start


About this series
The Hello World series is for novice developers who want a high-level, hands-on overview of IBM software products. Each tutorial in the series provides simple exercises and step-by-step instructions to familiarize you with the components and use of a particular product. The exercises only cover the basic concepts, but are enough to get you started.

About this tutorial


This tutorial introduces you to WebSphere Portal. Two exercises provide step-by-step instructions to give you a complete end-to-end experience. You will

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 1 of 41

developerWorks

ibm.com/developerWorks

develop and test a portlet in a development environment, and then deploy the portlet in a production environment.

System requirements
To complete Exercise 1: Develop and test a portlet in a development environment, install Rational Application Developer V7. During the installation, check the option to install the feature Portal tools to get the WebSphere Portal test environment.. For Exercise 2: Deploy a portlet in a production environment, you need WebSphere Portal V6. You can download a free, trial version of WebSphere Portal Express V6 at no cost.

Section 2. Introduction
What is WebSphere Portal?
IBM WebSphere Portal is a framework that includes a runtime server, services, tools, and many other features for integrating your enterprise into a single, customizable interface called a portal. A portal is a Web site that provides users with a single point of access to resources and services. A portal built with IBM WebSphere Portal 6.0 offers a single point of personalized interaction to resources and services, including applications, content, people, and business processes. Figure 1 shows a high level view of the architecture. Figure 1. IBM WebSphere Portal architecture

WebSphere Portal V6 Page 2 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

WebSphere Portal basic concepts and definitions


Portlet To a user, a portlet is a window on a portal Web site that displays information. To a developer, it is an application. Rational Application Developer or Rational Software Architect can be used to develop, test, and debug portlets. There are many sample portlets available for download. Portlet API WebSphere Portal supports industry standard JSR 168 Portlet API. The IBM Portlet API is being deprecated for Version 6. Portlet application A collection of related portlets that share the same resources (for example, images, properties files, and classes). Portal page

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 3 of 41

developerWorks

ibm.com/developerWorks

A portal page contains one or more portlets. Portal Web site A portal Web site is built with portal pages. Portal server runtime The execution environment for the portlets. Also called the portlet container, it is a J2EE application that runs on WebSphere Application Server. Portlet versus servlet Portlets can be administered while the Portal Server is running (for example, Install/Remove portlet application, Create/Delete portlets, portlet settings). This is more dynamic than servlets. Portlets may not send errors directly to browsers, forward requests, or write arbitrary markup to the output stream. In WebSphere Portal, go to Portlet Specification for JSR 168 > Relationship with the Servlet Specification for details. Portal page layout The page layout defines the number of content areas within the page and the portlets displayed within each content area. Themes Themes represent the overall look and feel of the portal, including colors, images, and fonts. Skins Skin refers to the visual appearance of the area surrounding an individual portlet. Each portlet can have its own skin. See Resources for more information.

Key features
Customers can choose one of the three WebSphere Portal Multi-platform offerings: WebSphere Portal Server, WebSphere Portal Enable, and WebSphere Portal Extend. WebSphere Portal Server is the foundation offering that provides: The Portal framework Core portal functions WebSphere Portal Enable adds: Web content management

WebSphere Portal V6 Page 4 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

Document management Workflow WebSphere Portal Extend adds: Workplace forms Collaborative services

How WebSphere Portal compares in the portal market


IBM WebSphere Portal is well recognized, and continues to be in the leaders quadrant according to Gartner, as shown in Figure 2. The rating focuses on vision and ability to execute that vision. It also takes product features and track records into consideration. Figure 2. Gartner: Magic Quadrant for Horizontal Portal Products, 2006

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 5 of 41

developerWorks

ibm.com/developerWorks

Section 3. How WebSphere Portal fits into SOA


A service oriented architecture (SOA) is simply an IT architectural style that allows applications to be built to support the flexibility and integration required for today's businesses. Flexibility enables a business to change and adapt. Integration emphasizes the communication and interaction of business processes from end to end, both internally and externally, with customers and suppliers. Getting started with SOA is easier with the IBM SOA Foundation - an integrated, open-standards-based set of software, best practices, and patterns for SOA. The software that comprises the IBM SOA Foundation was carefully selected from the leading-edge IBM software portfolio to support each phase of the SOA life cycle, which includes four phases: model, assemble, deploy and manage. WebSphere Portal is part of the IBM SOA Foundation and supports the deploy phase of the SOA life cycle. The deploy phase includes a combination of creating the hosting environment for your applications and the actual deployment of those applications. WebSphere Portal is a hosting environment for the user interaction logic of your SOA application. Figure 3. IBM SOA life cycle

WebSphere Portal provides key functions to support SOA applications, as shown in Table 1 below. See Resources for more information. Table 1. WebSphere Portal functions that support SOA applications
Function Accessing Web Services from portlet Web Services for Remote Portlet (WSRP) Description Rational Application Developer provides tools to easily create a portlet to call a Web service. The WSRP standard simplifies the integration of remote applications and content into portals. With WSRP, portal administrators can select from a rich choice of remote content and applications and integrate them into their portal with a few mouse clicks and no programming effort.

WebSphere Portal V6 Page 6 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

Integrating business processes

WebSphere Portal supports the integration of your existing business processes and applications into the portal. Portals are the ideal interface for the human component of business processes. WebSphere Portal supports the portlets created by the WebSphere Portlet Factory. WebSphere Portlet Factory speeds WebSphere Portal deployments by automating portlet development. It provides an SOA entry point for companies by delivering SOA-based portal applications. WebSphere Portal Version 6.0 simplifies working with composite applications, enabling integration of information from multiple applications, and providing end users with the content they need based on their role and task.

WebSphere Portlet Factory

Composite applications

A portal is a logical and appropriate first step toward SOA implementation.

Section 4. About the exercises


This tutorial provides two exercises that give you complete end-to-end experience from development to production. The exercises have been designed so you can execute them independently of one another. You could proceed straight to Exercise 2 if you only want to learn about WebSphere Portal administrative tasks. In Exercise 1, you take the role of a developer to develop and test a portlet, called MyFirstPortlet, that is expected to have the look and feel shown in Figure 4. The portlet will have a form with two text boxes and a submit button. In the first text box, users are asked to enter their name. In the second text box, users are asked to enter a special greeting to a special someone. Upon clicking Submit, the greeting will be printed on the portlet page. You will develop the portlet using Rational Application Developer and test the portlet using Rational Application Developer's WebSphere Portal Test Environment. Figure 4. Look and feel of MyFirstPortlet

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 7 of 41

developerWorks

ibm.com/developerWorks

In Exercise 2, you take the role of the WebSphere Portal administrator to put MyFirstPortlet live in a production environment. You will first install MyFirstPortlet in WebSphere Portal, then customize the look and feel of the portlet. Finally, you will grant permission to a new user to use the portlet.

Section 5. Exercise 1. Develop and test a portlet


In this exercise, you take the role of a developer to create a new basic JSR 168 portlet, MyFirstPortlet, and test the portlet in Rational Application Developer's WebSphere Portal Test Environment. JSR 168 is a portlet specification standard for portlet development. In Rational Application Developer, full support is provided for developing portlets using this standard, including automatically generating JSR 168 portlet projects simply by executing a wizard.

Step 1. Start Rational Application Developer


Launch Rational Application Developer if it is not up and running.
Would you like to see these steps demonstrated for you? Show me

1.

From Windows, click Start > Programs > IBM Software Development Platform > IBM Rational Application Developer > Rational

WebSphere Portal V6 Page 8 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

Application Developer. 2. A window opens asking for the workspace directory. Click OK to accept the default.

Step 2. Create a new portlet project


1. 2. From the workbench, select File > New > Project. Select Portlet Project, as shown in Figure 5, and click Next. Figure 5. Select a wizard

3.

In the Portlet Project wizard, enter MyFirstPortlet for the Project name. The EAR Project Name and Portlet name are auto-filled by the wizard upon your entry of Project name. For Target Runtime, choose WebSphere Portal v6.0. For Portlet API, choose JSR 168 Portlet. For the Portlet type, choose Basic Portlet. Click Next. Figure 6. New Portlet Project features

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 9 of 41

developerWorks

ibm.com/developerWorks

4.

Accept the default values in the Portlet Settings panel, as shown in Figure 7, and click Next. Figure 7. Portlet Settings

WebSphere Portal V6 Page 10 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

5.

As shown in Figure 8, select the check boxes for Add action listener and Add JSP form sample in the Action and Preferences panel. Click Next. Figure 8. Action and Preferences

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 11 of 41

developerWorks

ibm.com/developerWorks

6.

In this exercise, you will not be using single sign-on. Accept the default values in the Single Sign On section, as shown in Figure 9, and click Next. Figure 9. Advanced Settings

WebSphere Portal V6 Page 12 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

7. 8.

Click Finish. Observe that the MyFirstPortlet Project you just created was generated in the Project Explorer pane. Figure 10. Project Explorer

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 13 of 41

developerWorks

ibm.com/developerWorks

Explore the files in your MyFirstPortlet project, and review the purpose of each file using Table 2 below. You will be modifying these files to create your own customized portlet. Table 2. Portlet files at a glance
File web.xml Purpose One of the two deployment descriptors required for portlets. It provides information to the server about all non-portlet resources. The other deployment descriptor required for portlets. It provides information to the server about all portlet related resources. A Java file containing the method doView() which is the first method that is executed when a portlet renders. When a user interacts with the portlet (such as selecting the Submit button), the method processAction() is called to process the user action that occurs. The session bean is used to pass data to the JavaServer Pages (JSP) files. The view JSP file is used to edit the display of a portlet in View mode. (In Portal, there is also Edit mode and Help mode.)

portlet.xml

MyFirstPortlet.java

MyFirstPortletSessionBean.java MyFirstPortletView.jsp

Step 3. Modify the session bean in MyFirstPortlet


WebSphere Portal V6 Page 14 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

Session beans are used to pass data to the JSP. In this step, create two new variables called myName and greeting to store the user's name and greeting message. 1. In Project Explorer expand MyFirstPortlet > Java Resources: src > com.ibm.myfirstportlet and double click the file MyFirstPortletSessionBean.java, as shown in Figure 11. Figure 11. MyFirstPortletSessionBean.java file

2.

Delete all the class variables and methods from the MyFirstPortletSessionBean class, and create new private Strings for myName and greeting. The SessionBean class should now look like as follows.

package myfirstportlet; public class MyFirstPortletPortletSessionBean { private String myName = ""; private String greeting = ""; }

3.

Right-click in the MyFirstPortletSessionBean window and select Source > Generate Getters and Setters, as shown below. Figure 12. Generate Getters and Setters

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 15 of 41

developerWorks

ibm.com/developerWorks

4.

Check the boxes for the variables greeting and myName, as shown in Figure 13. This wizard generates the getters and setters for both variables. Click OK. Figure 13. Select Getters and Setters to create

WebSphere Portal V6 Page 16 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

5.

Save the file by pressing Ctrl-S.

You can see errors in the other classes. Don't worry, you will fix these errors later.

Step 4. Modify the JSP in MyFirstPortlet


In this step, modify the JSP file and create a form with two text boxes and a submit button. 1. In Project Explorer, expand MyFirstPortlet > WebContent > MyFirstPortlet > JSP > html and double click the file MyFirstPortletView.jsp. Modify the JSP file with the code shown below, and save the changes. The sample code that is generated with the project is very similar to the

2.

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 17 of 41

developerWorks

ibm.com/developerWorks

code you need to type in. To reduce the chances of making an error, focus on the items in bold in the code below. Change the variable FORM_TEXT to FORM_NAME Create a new variable similar to FORM_TEXT called FORM_GREETING Change the if statement to also check if the strings stored sessionBeans are empty As you type, you can also use the Code Assist (Ctrl-Space) function to help complete the keywords.
<%@ page session="false" contentType="text/html" import="java.util.*,javax.portlet.*, myfirstportlet.*" %> <%@taglib uri="http://java.sun.com/portlet" prefix="portlet" %> <portlet:defineObjects/> <% MyFirstPortletPortletSessionBean sessionBean = (MyFirstPortletPortletSessionBean)renderRequest.getPortletSession().getAttribute (MyFirstPortletPortlet.SESSION_BEAN); %> <DIV style="margin: 12px; margin-bottom: 36px"> <% String formName = sessionBean.getMyName(); String formGreeting = sessionBean.getGreeting(); if( formName.length()>0 && formGreeting.length() > 0) { %> '<%=formName%>' wants to wish you '<%=formGreeting %>'. <% } %> <FORM method="POST" action="<portlet:actionURL/>"> <LABEL for="<%=MyFirstPortlet.FORM_NAME%>">Enter Your Name:</LABEL><BR> <INPUT name="<%=MyFirstPortlet.FORM_NAME%>" type="text"/><BR> <LABEL for="<%=MyFirstPortletPortlet.FORM_GREETING%>">Greeting:</LABEL><BR> <INPUT name="<%=MyFirstPortlet.FORM_GREETING%>" type="text"/><BR> <INPUT name="<%=MyFirstPortlet.FORM_SUBMIT%>" type="submit" value="Submit"/> </FORM> </DIV>

3.

Save the file by pressing Ctrl-S.

Step 5. Modify the MyFirstPortlet.java file


In this step, you'll modify the MyFirstPortlet.java file to support the changes we made in the JSP and the sessionbean in previous steps. 1. In Project Explorer, expand MyFirstPortlet > Java Resources: src >

WebSphere Portal V6 Page 18 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

com.ibm.myfirstportlet and double click the file MyFirstPortlet.java. 2. Modify the code, as shown below. Add the FORM_NAME and FORM_GREETING variable. Delete the variable FORM_TEXT (this variable was part of the generated sample code).
public public public public public static static static static static final final final final final String String String String String VIEW_JSP = "MyFirstPortletPortletView"; SESSION_BEAN = "MyFirstPortletPortletSessionBean"; FORM_SUBMIT = "MyFirstPortletPortletFormSubmit"; FORM_NAME = "MyFirstPortletPortletFormName"; FORM_GREETING = "MyFirstPortletPortletFormGreeting";

Modify the processAction() method, as shown below.


public void processAction(ActionRequest request, ActionResponse response) throws PortletException, java.io.IOException { if( request.getParameter(FORM_SUBMIT) != null ) { // Set form text in the session bean MyFirstPortletPortletSessionBean sessionBean = getSessionBean(request); if( sessionBean != null ) { sessionBean.setMyName(request.getParameter(FORM_NAME)); sessionBean.setGreeting(request.getParameter(FORM_GREETING)); } }

4.

Save the file by pressing Ctrl-S.

Step 6. Run MyFirstPortlet in the WebSphere Portal Test Environment


In Rational Application Developer, you can locally test and debug your portlet applications using the WebSphere Portal Test Environment. In this step, add the MyFirstPortlet Project in the WebSphere Portal v6.0 Test Environment (PTE) and then run the project in the PTE. 1. In the Servers pane, right-click WebSphere Portal v6.0 Server and click Add and Remove Projects. Figure 14. Add and Remove Projects in PTE 6.0

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 19 of 41

developerWorks

ibm.com/developerWorks

2.

Ensure that MyFirstPortlet is listed in the Configured Projects pane. If it is not, highlight MyFirstPortlet and click Add >, as shown below. Click Finish. Figure 15. Add MyFirstPortletEAR to PTE

WebSphere Portal V6 Page 20 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

In the Servers pane, observe that MyFirstPortlet is added to the WebSphere Portal v6.0 server @localhost. Figure 16. Servers

4.

Start the WebSphere PTE on your local machine. From Servers, right-click WebSphere Portal v6.0 Server and click Publish, as shown below. This starts the WebSphere Portal v6.0 server, and publishes the MyFirstPortlet to the server. It might take a few minutes to complete this step. Figure 17. Start the PTE

When the WebSphere PTE has started and the MyFirstPortlet is published, an indication in Servers in the Status section appears. Figure 18. PTE start status

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 21 of 41

developerWorks

ibm.com/developerWorks

6.

You can test the MyFirstPortlet on the WebSphere PTE right here in your local development environment. Right-click WebSphere Portal v6.0 Server in Servers and choose Open Portal. Figure 19. Open Portal

MyFirstPortlet is launched in the IBM WebSphere PTE window in Rational Application Developer. Figure 20. MyFirstPortlet launched in PTE

WebSphere Portal V6 Page 22 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

8.

Test the portlet by typing in your name, and a special greeting for a special someone. Since April first just passed, type in Happy April Fool's Day!. In Enter Your Name, type your name. In Greetings, type Happy April Fool's Day. Click Submit. Figure 21. Testing MyFirstPortlet in PTE

Observe that the greeting is displayed in your portlet. Figure 22. MyFirstPortlet displays a message

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 23 of 41

developerWorks

ibm.com/developerWorks

10. Click Submit again in the form. Leave both text boxes blank this time. What happens? 11. Stop the Portal Test Server. Right-click WebSphere Portal v6.0 Server and select Stop.

Step 7. Export MyFirstPortlet


At this point it's time to export your portlet. 1. In Project Explorer, right-click MyFirstPortlet. Select Export > WAR file. Figure 23. Export WAR file

WebSphere Portal V6 Page 24 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

2.

In Destination, browse to a directory of your choice, as shown in Figure 24. Select the check box for Export source files, and click Finish. Figure 24. Export WAR file to specified destination

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 25 of 41

developerWorks

ibm.com/developerWorks

Section 6. Exercise 2. Deploy a portlet


In this exercise, you take the role of the WebSphere Portal administrator to install MyFirstPortlet in WebSphere Portal. Then, customize the look and feel of the portlet, and finally grant permission to a new user to use the portlet.

Step 1. Start WebSphere Portal


Start the WebSphere Portal Server if it is not already running.
Would you like to see these steps demonstrated for you? Show me

To start the service on Windows, click Start > Settings > Control Panel > Administrative Tools > Services > IBM WebSphere Application Server V6 WebSphere_Portal_ ...

Step 2. Log in to WebSphere Portal


1. Open a browser and enter the URL http://<hostname>:<port_number>/wps/portal where

WebSphere Portal V6 Page 26 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

<hostname> is the fully qualified host name of the machine that is running WebSphere Portal, and <port_number> is the port number (it is displayed on the confirmation panel during your install). For example, http://www.ibm.com:10038/wps/portal 2. Log in using your WebSphere Portal administrator user ID and password.

Step 3. Install MyFirstPortlet in WebSphere Portal


1. Select Administration, from the top right. Figure 25. WebSphere Portal Welcome Page

2.

In the left pane, select Portlet Management > Web Modules. Click Install on the Manage Web Modules page. Figure 26. Manage Web Modules

3.

The Installing a Web Module wizard appears, as shown in Figure 27. Browse to the directory where you exported the MyFirstPortlet.war file from Exercise 1 of this tutorial, or where you downloaded the MyFirstPortlet.war from the Downloads section. Figure 27. Installing a Web Module

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 27 of 41

developerWorks

ibm.com/developerWorks

4. 5.

In Step 2 of the wizard, review the portlet application that is going to be installed. Click Finish. Once the installation is complete, a message indicates the installation was successful at the top of the page, as shown below. MyFirstPortlet.war now appears in the list of Web modules shown on the page. Figure 28. Portlet successfully installed

Step 4. Add MyFirstPortlet to a WebSphere Portal page


Although you have successfully installed MyFirstPortlet in WebSphere Portal, you can not see the portlet because it has not been added to a Portal page yet. There are two ways to add a portlet to a Portal page: Portlet Palette or Edit Page Layout. In this step, add the portlet to a WebSphere Portal Welcome page using the Edit Page Layout. 1. In the left pane, select Portal User Interface > Manage Pages as shown below. Figure 29. Manage Pages

WebSphere Portal V6 Page 28 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

2. 3.

In the Manage Pages window, select Context Root, then Home. Locate the Welcome page in the list (it should be first) and click the Edit Page Layout button corresponding to this page. By clicking , you can edit the layout of the page. Figure 30. Manage Welcome Page

4.

Add MyFirstPortlet to the top right in the Welcome page by clicking on Add Portlets in the right column in the layout. Figure 31. Edit Layout

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 29 of 41

developerWorks

ibm.com/developerWorks

5.

A search screen renders on the page to let you search for the portlet you want to add. As shown in Figure 32, type MyFirstPortlet in the Search text box. Figure 32. Edit Layout search window

6.

In the search results, select the MyFirstPortlet check box and click OK. Figure 33. Edit Layout search results

7.

MyFirstPortlet portlet appears in the right column of the layout page. Figure 34. Edit Layout with MyFirstPortlet added

8.

To further customize the Welcome page, move MyFirstPortlet to the top of the right column. Click the Move portlet up button to move the portlet up on the page until it appears at the very top of the column.

WebSphere Portal V6 Page 30 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

9.

Click Done.

10. At the bottom left of the page, click Home, as shown below, to exit the Administration pages and go to the Welcome page. Figure 35. Go to Welcome Page

11. MyFirstPortlet appears at the top right. Figure 36. MyFirstPortlet added to Welcome Page

Step 5. Change the look and feel of MyFirstPortlet


In WebSphere Portal you can customize the look and feel of a Portal page by applying a new theme and skin. A theme provides the layout and appearance of a portal, such as the color and fonts used. A skin represents the border surrounding the portlet component. In this step, apply a new skin type called Thin Skin to the MyFirstPortlet portlet. 1. Select Portal User Interface > Manage Pages.

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 31 of 41

developerWorks

ibm.com/developerWorks

2.

In the Manage Pages window, locate the Welcome page in the list (it should be first) and click the Edit Page Layout button corresponding to this page. By clicking , you'll be able to edit the page, including the appearance. Select Appearance in the upper left corner. You can see the layout of the Welcome page. In the MyFirstPortlet box, select Thin Skin as the skin, as shown below. Click Done. Figure 37. Appearance portlet

3.

4.

Exit the Administration pages by clicking Home at the bottom-left corner. Notice that the skin of MyFirstPortlet has now changed, as shown in Figures 38 and 39 below. Figure 38. MyFirstPortlet using Default Skin

Figure 39. MyFirstPortlet with Thin Skin

WebSphere Portal V6 Page 32 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

5.

Exit WebSphere Portal by clicking Log out in the upper-right corner.

Step 6. Access MyFirstPortlet 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. 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 WebSphere Portal, and <port_number> is the port number. For example, http://www.ibm.com:10038/wps/portal Click the Sign up link above Log in, or the Sign up now link on the right. Fill in your user profile information to enroll in WebSphere Portal. You can choose your own user ID in Portal. In the example in Figure 40, the User ID registered is John. Figure 40. Sign up as new user in WebSphere Portal

2. 3.

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 33 of 41

developerWorks

ibm.com/developerWorks

4.

Click OK. A message is displayed saying the user was created successfully. Figure 41. User created successfully in Portal

5. 6.

Log in to Portal using the newly created user John. Do you see MyFirstPortlet on the Welcome page? MyFirstPortlet is not on user John's Welcome page. When you installed the MyFirstPortlet in WebSphere Portal, you did not grant any users with access permission to the portlet. That is why you can only view the portlet as the administrator. No other users can view MyFirstPortlet in the Welcome page at this point. Exit WebSphere Portal by clicking Log out in the upper-right corner.

7.

Step 7. Grant permission to All Authenticated Users to

WebSphere Portal V6 Page 34 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

MyFirstPortlet
1. 2. 3. 4. Log in to WebSphere Portal as the Administrator again. Select Administration on your right. Select Access > Resource Permissions. In the Resource Permissions page, as shown below, click Portlets. Figure 42. Resource Permissions Portlet

5.

Enter MyFirstPortlet as the search criteria. Click Search. Figure 43. Search for MyFirstPortlet in Resource Permissions

6.

Click the Assign Access button displayed beside the MyFirstPortlet resource. Figure 44. Assign access to MyFirstPortlet

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 35 of 41

developerWorks

ibm.com/developerWorks

7.

Click the Edit Role button beside the Role User. Figure 45. Modify Access for a Role

8.

There are currently no members in this role, as shown below. This explains why you weren't able to see MyFirstPortlet when you logged in as a user that is not an administrator (for example, John). Figure 46. Members with access are shown

9.

Click the Add button, as shown above, to add members to this role.

10. Select the All Authenticated Portal Users check box. Click OK. Figure 47. Give access to all Authenticated Portal Users

WebSphere Portal V6 Page 36 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

11. Log out of Portal, and log in as a user that is not an administrator. For example, John. Figure 48. Log in as a user

12. What do you see in the Welcome Page? Figure 49. MyFirstPortlet accessible to all users

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 37 of 41

developerWorks

ibm.com/developerWorks

WebSphere Portal V6 Page 38 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

Downloads
Description
Sample for the exercises in this tutorial Information about download methods

Name

Size

Download method
HTTP

MyFirstPortlet.war10KB

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 39 of 41

developerWorks

ibm.com/developerWorks

Resources
Learn New to WebSphere Portal provides a high level overview of WebSphere Portal. IBM WebSphere Portal Business Solutions: This catalog has news, information about solutions, samples, demos, and much more. Read the JSR 168: Portlet Specification. Gartner: Magic Quadrant for Horizontal Portal Products, 2006: Learn more about the horizontal portal product market. Opening the door to a service oriented architecture IBM Workplace, Portal and Collaboration products for an SOA. SOA describes SOA services and products from IBM. Learn more about the IBM SOA Foundation. One of IBM Redbooks, IBM Rational Application Developer V6 Portlet Application Development and Portal Tools, provides an overview and hands-on scenarios to help you design, develop and implement portlet applications using Rational Application Developer V6.0 and the provided Portal Tools. Read about the OASIS Web Services for Remote Portlet (WSRP) technical committee, which is standardizing presentation-oriented Web services for use by aggregating intermediaries, such as portals. The IBM WebSphere Portal Version 6.0 Information Center explains How WSRP works. "Architecting on demand solutions, Part 18: Use IBM WebSphere Integration Developer to assemble components" (developerWorks, Feb 2006) explains how to set up human tasks, business process integration, and security. IBM WebSphere Portlet Factory: Read about the features and benefits. A Portal May Be Your First Step to Leverage SOA: This Gartner Management Update explains that to implement a service-oriented architecture (SOA), companies must consider what steps and technologies are involved. Portals represent a logical first step in the process. Get products and technologies Download a free, trial version of Rational Application Developer V7 to use with this tutorial. Download a free, trial version of WebSphere Portal Express V6 to use with this tutorial. Download IBM product evaluation versions and get your hands on application development tools and middleware products from DB2, Lotus, Rational, Tivoli, and WebSphere.

WebSphere Portal V6 Page 40 of 41

Copyright IBM Corporation 1994, 2007. All rights reserved.

ibm.com/developerWorks

developerWorks

Discuss Participate in the discussion forum for this content. Check out developerWorks blogs and get involved in the developerWorks community.

About the authors


Laura Chan Laura Chan is an Advisory Software Developer at the IBM Software Group Scenario Analysis Lab. Her current responsibility is to lead the team to deliver customer relevant solutions to improve cross-brand integration capability of Software Group products. Her past experiences also include product development, customer support, services and marketing.

Janet Lee Janet joined IBM full time after graduating with a Bachelor of Applied Science in Computer Engineering degree from the University of Waterloo. She has previously worked at various IBM software functions within the Toronto IBM Software lab, including the DB2 Regression team and the Java Just-in-Time Compiler Development team. Janet is currently a part of Software Group Strategy, Scenario Analysis Lab, where she is implementing a customer-based scenario named the Employee Workplace, using various IBM products such as DB2 Content Manager, DB2 Document Manager, DB2 Records Manager, WebSphere Information Integrator OmniFind Edition, and WebSphere Portal.

Trademarks

WebSphere Portal V6 Copyright IBM Corporation 1994, 2007. All rights reserved.

Page 41 of 41

You might also like