JBoss.orgCommunity Documentation

Chapter 2. JBoss Portlet Tools Tasks

2.1. Creating and Deploying a Java Portlet
2.1.1. Creating a Web Project with JBoss Portlet Capabilities
2.1.2. Adding a Java Portlet to a Web Project
2.1.3. Deploying a Portlet to JBoss Portal
2.2. Creating and Deploying a JSF Portlet
2.2.1. Creating a JSF Project with JBoss Portlet Capabilities
2.2.2. Adding a JSF Portlet to the Project and Deploying It to JBoss Portal
2.3. Creating and Deploying a Seam Portlet
2.3.1. Creating a Seam Project with JBoss Portlet Capabilities
2.3.2. Adding a Seam Portlet to the Project and Deploying It to JBoss Portal

This chapter shows how to create a Dynamic Web Project, add a Java Portlet to it and deploy it to the JBoss Portal.

Follow the next procedure to create a Web project with JBoss Portlet capabilities pointed to the JBoss Portal runtime.

  1. Select FileNewDynamic Web Project if you are in the Web perspective or select FileNewOtherWebDynamic Web Project in any other perspective. This will display the New Dynamic Web Project wizard.


  2. Specify the name of the project.

  3. Click the New in the Target Runtime area to create a JBoss Portal runtime. Choose JBoss Community > JBoss 4.2 Runtime and select the Create a new local server check box below. Click the Next button.


  4. The New Server Runtime Environment wizard appears. In the Name field, type JBoss Portal 2.7 Runtime, and then use the Browse button to point to the location of JBoss Portal + JBoss AS extracted. Click Next button to proceed.


  5. At this point a new JBoss Server instance will be created. On the next page you can verify the runtime information and configuration. If something is incorrect, press the Back button to return to the previous wizard page. Click the Finish button.


  6. Click the Modify button in the Configuration area to enable a portlet facet for the project.


  7. In the Project Facets dialog, check JBoss Core Portlet and click the OK button.


  8. The Java and Web Module pages are for configuring Java and Web modules in the project. Here the default values are fine, so leave everything as it is.

  9. The last wizard page will ask you to add JBoss Portlet capabilities to the project. Select Portlet Target Runtime Provider and click the Finish button to complete the project creation.


As the result, JBoss Portlet Tools adds JBoss Core Portlet facet to the project, creates an empty portlet.xml file and adds the JBoss Portlet library to the project classpath.


This chapter will explain how you can configure a JSF portlet within a JSF project with JBoss Portlet capabilities and then deploy it to JBoss Portal.

You can create a JSF project with JBoss Portlet capabilities in two ways:

Refer to the further sections for the procedures on how to do this.

The basic steps to create a dynamic Web project with the JBoss Portlet capabilities are as follows:

  1. Start the Dynamic Web Project wizard navigating to FileNewOtherWebDynamic Web Project.


  2. Specify the project name and set the target runtime to JBoss Portal by following the points 3, 4 and 5 in the Section 2.1.1, “Creating a Web Project with JBoss Portlet Capabilities” procedure.

  3. In the Configurationarea, click the Modify button and enable JavaServer Faces,JBoss Core Portlet and JBoss JSF Portlet facets. Click the OK button.


  4. You may leave the next two wizard pages with their defaults, just press the Next button to proceed.

  5. On the JBoss Portlet Capabilities page, select Portlet Target Runtime Provider and click the Next button.


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


  7. On the JBoss JSF Portlet Capabilities page, select JSF Portlet Target Runtime Provider as the JSF portlet implementation library. It will copy Portlet Bridge libraries from the server runtime to the project classpath.


    Tip:

    On this page, it is also possible to add the RichFaces libraries from the RichFaces distribution by checkingAdd/Change Richfaces Libraries.

  8. Click the Finish button. The project will be created in the workbench.

This chapter covers the steps required to configure a Seam portlet within a Seam project with the help of the JBoss Portlet Tools features.

One of the following two procedures can be used to create a Seam project with JBoss Portlet capabilities enabled:

  1. Create a dynamic Web project with the Seam and JBoss Portlets facets enabled (see Section 2.3.1.1, “Creating a Dynamic Web Project with Seam and JBoss Portlet Capabilities”)

  2. Create a Seam project with the JBoss Seam portlet configuration using the wizard JBoss Seam Tools provides and follow all the wizard steps to enable JBoss Portlet capabilities (see Section 2.3.1.2, “Creating a Seam Project with JBoss Portlet Capabilities”)

To create a dynamic Web project with Seam and JBoss Portlet capabilities you should complete the following steps:

  1. Select. FileNewOtherWebDynamic Web Project. The New Dynamic Web Project wizard will then be displayed.


  2. Give the project a name and follow the steps 3, 4, 5 of the Section 2.1.1, “Creating a Web Project with JBoss Portlet Capabilities” procedure to set the target runtime.

  3. In the Configuration area of the first wizard page, select JBoss Seam Portlet Project v2.0. It will add needed facets to the project.

    Tip:

    If you now click the Modify button, you should see theJavaServer Faces,Jboss Portlets and Seam facets enabled.


  4. The next two pages are for adjusting the project Java and Web modules. They include the default values, so you can skip them by clicking the Next button.

  5. On the Jboss Portlet Capabilities page, select Portlet Target Runtime Provider as the portlet implementation library.

  6. The next page is for configuring JSF capabilities. As it contains the default values, just click the Next button to proceed.

  7. On the Seam Facet page, set a Seam runtime and a connection profile.

    Tip:

    For details about how to set a Seam runtime and a connection profile, see Configure Seam Facet Settings in the Chapter 2 of the Seam Dev Tools Reference Guide.


  8. On the JBoss JSF Portlet Capabilities page, select the JSF Portlet Target Runtime Provider type of the implementation library.


    It will add JBoss Portlet Bridge libraries to the project classpath.

  9. Click the Finish button to complete the project creation.