JBoss.orgCommunity Documentation

JBoss Portal Tools Reference Guide

Svetlana Mukhina

Thomas Heute

Version: 1.0.1.GA

September 2008


1. Introduction
1.1. Preface
1.2. Key Features
1.3. Other relevant resources on the topic
2. Installation issues
3. Starting the Project with JBoss Portal
3.1. Creating a Dynamic Web Project
3.2. The Project Structure Overview
3.3. Adding a Java Portlet to the Project
3.4. Deploying a Portlet to JBoss Portal
4. Creating JSF Portlet
4.1. Adding JSF Portlet to Dynamic Web Project
4.2. Adding JSF Portlet to JSF Project
5. Creating Seam Portlet
5.1. Adding Seam Portlet to Dynamic Web Project
5.2. Adding Seam Portlet to Seam Project
6. Adding Portlets to non-WTP Projects

Starting from 3.0.0.Alpha1 version, JBoss set of plugins extends JBoss Portal features. Thus, this guide is intended to explain you how to manage the functionality JBoss Tools provide to ease the development with JBoss Portal.

This section provides you with the steps on how to start with JBoss Portal and integrated features using JBoss Tools.

Now, when you have it installed, we are going to demonstrate some powerful features of JBoss Portal tooling for Eclipse.

To get started with JBoss Portal and JBoss Tools, you should first have a Web Project pointed to the JBoss Portal Runtime. Thus, in this chapter we are going to show you how to create a Dynamic Web Project, add Java Portlet to it and deploy it to the JBoss Portal.

To create a Dynamic Web Project, go to File > New > Dynamic Web Project if you are in the Web Perspective or File > New > Other > Web > Dynamic Web Project in any other Perspective. The first page of the New Dynamic Web Project wizard looks as follows.


Fill out the name of your project. Next, click the New button in the Target Runtime section to specify a new Target Runtime. Choose JBoss Community > JBoss 4.2 Runtime and select the Create a new local server checkbox. Click Next.


On the next page you should give a name to the runtime. Let's call it JBoss Portal 2.7 Runtime , and then point it to the location of your JBoss AS + Portal installation.


Note:

The JBoss Tools Portlet feature has been tested using 2.6.5 and 2.7.0.ALPHA versions of JBoss Portal. Remember, if you want to use Portlet version 2.0 (JSR-268), you have to choose JBoss Portal 2.7.

At this point a new JBoss Server instance will be created. Here you can verify the defined runtime information. If something is incorrect, press Back to return on the previous wizard page.


Click Finish.

On the next step you should click the Modify button next to the Configuration section to enable Portlet Facets for the project.


On this page you should check the JBoss Core Portlet and press OK .


Note:

If the portlet libraries aren't available in the runtime you targeted, JBoss Portlet facets will be hidden on this page.

To made portal functionality always visible no matter what the runtime support, you should go to Window > Preferences and then JBoss Tools > JBoss Portlet and deselect Check runtimes for Portlet Components checkbox (see figure below).


The next page is for configuring web modules. Here all values are set, so you can leave everything as it is.


Finally, the last wizard page will ask you to add JBoss Portlet capabilities to your project. Here you can choose whether to set up user libraries, libraries provided by server runtime or not include libraries at all.

  • To set up server runtime libraries, you need to select Libraries provided by server runtime in the list box.


  • For setting up user libraries, select User library in the list box and then press Add in the User Library section.


Then press New and type the user library name in the appeared dialog.


Next add necessary jar's.


Hit OK. The user library will be added.


  • If you don't need to include libraries at all, just deselect the Enable implementation library checkbox.


After setting JBoss Portlet capabilities press Finish.

That's it! Our base project is done.

At this point we'll show what the steps you need to proceed to add a new Java Portlet to the project.

Call the Create Portlet wizard by selecting New > Other > JBoss Tools Web > Portlet > Java Portlet.


The wizard fills in the Web Project and Source Folder fields for you. Then you need to specify the Java package and the Class name and click Next .


On the other page you will be able to set the display name of the Portlet, a title, a description, the supported modes and init parameters.


On the next screen you can define which methods from GenericPortlet you want to override.


The last screen lets you build JBoss Portal specific descriptors to create an instance during the deployment and place it directly on the Portal.


Tip:

If you uncheck the Create Portlet Instance checkbox, JBoss Tools won't create the deployment elements in the default-object.xml and portlet-instances.xml files.

Once Java Portlet is created, new resources have been added to the project structure. As you can see on the figure below, it adds a Java Portlet class ( TestPortlet.java in our case), default-object.xml and portlet-instances.xml files and updates portlet.xml as well.


Thus, now the Project is ready to be built and deployed.

This chapter will explain how you can configure JSF Portlet within Dynamic Web Project and JSF Project by using the wizards JBoss Tools provides.

To add JSF Portlet to a Dynamic Web Project, you should set the Configuration to JavaServer Faces v1.1 Project or JavaServer Faces v1.2 Project and configure the JSF Portlet Facets in the New Dynamic Web Project wizard by clicking the Modify button.


On the Project Facets dialog you should select JBoss Core Portlet and JBoss JSF Portlet check boxes.


Next wizard page is for configuring JSF Capabilities. You can leave everything as it is here.


To support Portlets in JSF/Seam applications JBoss Tools works with JBoss Portlet Bridge. Thus on the next page you should add JSF Portlet capabilities by pointing to the Portletbridge Runtime location.


Next click Finish to organize the Project.

To add JSF Portlet to generated project you should call the Create Portlet wizard by navigating to New > Other > JBoss Tools Web > Portlet > JSF/Seam Portlet.


As you see, the Seam and JSF Portlet wizards are merged into one. We set JSF Configuration for the project, so default values in this wizard will be set as for a JSF portlet.


Click Finish to complete JSF Portlet creation. Now you can deploy the project the same way as it was described above.

In the Browser JSF Portlet looks as follows.


This chapter covers the steps on how to configure Seam Portlet within Dynamic Web Project and Seam Project by using the wizards JBoss Tools provides.

To add Seam Portlet to a Dynamic Web Project first you should organize New Dynamic Web Project with the Configuration setting to JBoss Seam Portlet Project v2.0.


It will add all needed facets to your project. By clicking the Modify button you can observe the chosen configuration of facets as well as modify it. As you can see, all JBoss Portlets are checked.


Next wizard pages are for adjusting the Project Web Modules and JSF Configuration. They include default values, so you can skip them by pressing Next.

On the Seam Facet page set Connection Profile and hit Next.


Last wizard page will prompt you to set the path to Portletbridge Runtime location.


Now, to add Seam Portlet to the project you should follow to New > Other > JBoss Tools Web > Portlet > JSF/Seam Portlet. This will call the wizard for creating JSF/Seam Portlets.


As we set Seam Configuration for the Dynamic Web Project, the wizard puts the values as for Seam Portlet.


After creating the Seam Portlet, you should deploy the project to JBoss Portal and start the Server. In a Browser you'll see the following:


Starting from JBoss Tools 3.0.0.Beta1 version the JBoss Portlet wizards no longer require a WTP project to be able to create Portlets.

In conclusion, with this document you've learnt how to get started with JBoss Portal using JBoss Tools suite of Eclipse plugins. The above chapters walked you through the steps on how to organize a web project with portlets which includes a sample staff and deploy it onto the JBoss Portal.

If you still have questions or suggestions you are always welcome on our Forum. Your feedback will be very much appreciated.