User:Mwc8630
Contents
An Introduction to Websphere Portal V 5.1.0.0[edit]
Websphere Portal is a program that provides a Portal Server environment for deploying portlets to, and hosting on, the web. When used in conjunction with IDEs such as Websphere Studio or Rational Application Developer, it is a powerful tool that can create complex portlet content in a surprisingly simple manner. The remainder of this article describes how to create and deploy a very simple "Hello World!" portlet application and serves as an introduction to the use of RAD for portlet development.
Getting Started[edit]
Before you begin, it should be noted that a copy of Rational Application Developer (RAD), preferably version 6.0.1, and Websphere Portal, version 5.1.0.0, are needed to complete this exercise.
Starting The Portal Server[edit]
In RAD, locate the "Server" window. If this window is not currently displayed, open "Window", "Show View", "Other...". Open the "Server" folder and select "Servers". You should see an instance of the server "Websphere v5.1 Test Environment @ localhost" listed. If this entry does not exist, right-click, select "New" and "Server". Select "Websphere v5.1 Test Environment", and click "Finish". There should be a new server listed in the "Servers" view. Start this server by right-clicking it and selecting "Start".
Currently, it also seems that the easiest and most reliable way to deploy content is to also create a "server attach", and run your portlets through that. This can be accomplished by right-clicking in the server window and selecting "New", "Server", and "Websphere Portal v5.1 Server Attach @ localhost". Click Finish. You must now publish your server attach. Right-click on the new entry in the Servers window, which should be called "Websphere v5 Server Attach", and select "Publish".
At this point, you should be able to view the Websphere Portal's administrative content through a web browser. First, determine the port number of your server (the default is 9080) by double clicking your server in the "Servers" window and selecting the "Ports" tab in the new window that opens up. Open up Mozilla, and type in:
http://localhost:<port number>/wps/myportal/
The Websphere Portal interface should be displayed and prompt the user for a username and password, which you specified during the portal software installation process. Supply this information and you will enter the administrative view. If the browser cannot display your portal view, see the Troubleshooting section below.
Making a new Portlet Project[edit]
Begin by starting up RAD and opening the Web perspective. In the File menu, select "New", "Portlet Project (JSR 168)". A wizard for creating the project will appear. Give your portlet a name (for the rest of this tutorial, we will assume you have named it HelloWorld), and click "Finish". (There are a multitude of options available in the wizard for portlet creation, however, it is not necessary that they be customized for this simple example.) A new project, labeled HelloWorld should appear in your "Package Explorer" window under "Dynamic Web Projects", along with a directory labeled HelloWorldEAR under "Enterprise Applications".
Deploying the Basic Portlet's Default Content[edit]
The default portlet project includes a skeleton implementation of a simple portlet. To deploy this built-in portlet "as is", right-click the EAR directory and select "Run", "Run on Server...". Select the server attach that you previously configured and click "Finish". If done correctly, a web browser should open in RAD, displaying the default portlet content, in a window that looks like this:
NOTE: You MAY receive the following error message even if the portlet has been correctly deployed:
At this point, it is advised that you simply ignore this error.
Congratulations on successfully deploying your first portlet!
Deploying your Hello World Portlet[edit]
When you initially create your portlet project, you may have noticed that it is made up of a large group of directories and files. One of these files, named HelloWorldPortletView.jsp (assuming you named your project HelloWorld) is mainly responsible for displaying the portlet content that the user sees. Locate this file by opening your portlet project in the project explorer window and navigating to \WebContent\helloworld\jsp\html\HelloWorldPortletView.jsp.
Replace the default content in the view file with, simply:
Hello World!
Redeploy the portlet, and note the changes.
Troubleshooting[edit]
If the portlet does not deploy within a few moments, or you receive a different error message suggesting deployment has not occurred, take the following steps to attempt at re-deployment.
- In a Windows Explorer window, locate the directory ...\Portal51UTE\PortalServer\bin, where you installed Websphere Portal.
- Locate the file "startServer5.bat", and execute it by double-clicking its icon.
Wait for the script to completely run (a command line window should appear, and it will prompt you to "press any key to continue" when it's finished), and attempt to deploy your portlet by first republishing your server attach, and following the instructions in Deploying the Portlet's Default Content above. Currently, this error occurs quite frequently, though it is most always fixed by performing these troubleshooting steps.
No comments:
Post a Comment