|< Day Day Up >|| |
In this section we show how to use Application Developer to develop the Hello World portlet described in the previous section, and we export it for deployment to WebSphere Portal Server on z/OS.
Start Application Developer and from the menu bar, and select Perspective -> Open-Other as shown in Figure 6-2 on page 186.
Figure 6-2: Opening Perspective Other
From the Select Perspective window select Portlet as shown in Figure 6-3.
Figure 6-3: Select the Portlet Perspective
Right-click in the Portlet Perspective Navigator frame and select New->Other, as shown in Figure 6-3.
Figure 6-4: Select Other for type of Project
In the New project window select Portlet development in the left frame and Portlet application project in the right frame as shown in Figure 6-5 on page 188, and then click Next.
Figure 6-5: Select to create a new Portlet application project
On the next window you need to enter settings that define the project name and location, the EAR file to be used and the URI context root. The settings we used are shown in Figure 6-6 on page 189. We clicked on Next to continue at this stage, and not Finish.
Figure 6-6: Define the project settings
The next window allows you to define the type of portlet to be used. Since this was going to be our first portlet with our own Java code using Application Developer, we chose a Basic portlet as shown in Figure 6-7. Click on Next to continue.
Figure 6-7: Choose the type of portlet to be created
The basic set of portlet parameters next need to be defined, and we chose the ones shown in Figure 6-8 on page 190, and then clicked on Finish.
Figure 6-8: Hello World portlet parameters
After clicking on Finish, Application Developer now builds the project which takes a few moments during which you will see several messages displayed as it creates directories, files, compiles Java code, until the project is created. The project is shown in the portlet perspective as seen in Figure 6-9 on page 191.
Figure 6-9: The Hello World project
To add the Java code we expanded the source tree in the Navigator panel of the Hello World project by selecting the "+" next to HelloWorld -> source -> com -> ibm -> myportlets, as shown in Figure 6-10 on page 192.
Figure 6-10: Expanded source tree
By double-clicking on HelloWorld.java we obtained the source view of the Java code that Application Developer had already generated for our project. Since this was our first Hello World java portlet we deleted all the generated code and instead copied the code from Example 6-1 on page 185.
We then changed the Java package to the portlet class name we had defined in "Hello World portlet parameters" on page 190 as shown in Figure 6-11 on page 193.
Figure 6-11: Hello World java
Using the keyboard we entered Ctrl+s, which causes Application Developer to build the project and save it. If there are no errors listed in the tasks frame at the bottom right of the Application Developer window then the portlet project has been built successfully and can be tested and deployed.
By right-clicking on the project name in the Navigator frame, and selecting Export WAR, as shown in Figure 6-12 on page 194, the portlet WAR file can be exported from Application Developer to a local directory of choice for deployment on WebSphere Portal for z/OS.
Figure 6-12: Export WAR for the Hello World portlet
Deployment of portlets is described in the next section and we will deploy out Hello World portlet in 6.4.4, "Deploy the Hello World Portlet" on page 222.
|< Day Day Up >|| |