Nội dung chính
This document presents an overview of JSR 168 Portlet development features available in MyEclipse 6.5.
To get a better feel for MyEclipse and learning more about it, please check out our product Documentation for more material.
In order to create a Portlet project, first it requires you start wiith an existing MyEclipse Web Project. Then you can add JSR 168 Portlet Capabilities to it to give it Portlet support. The Portlet Support includes configured web.xml (for Portal engines that have this requirement), generated portlet.xml, and all necessary JSR 168 runtime libraries.
Figure 2.1.1: Add Portlet Capabilities to Web Project
The Add Portal Capabilities wizard allows selection of the specific Portal engine to support:
Figure 2.1.2: Portal Capabilities Wizard
Once the Portal Capabilities wizard completes, the Web Project will be configured with JSR 168 runtime libraries, web.xml will be configured with necessary configuration, and a new portlet.xml file will have been added to the project as shown in Figure 2.1.3.
Figure 2.1.3: Initial Portlet Project Contents
MyEclipse provides wizards for JSR 168-compliant Portlet creation. This wizards can be invoked from the File > New > Other… > MyEclipse > Web category as shown in Figure 3.1.
Figure 3.1 New MyEclipse Portlet Wizard
This wizard will create the Portlet class and other required (or optional) resources in addition to registering the new portlet in the portlet.xml descriptor. First page of the wizard configures the Portlet class and allows the user to select from the list of predefined Portlet templates:
Figure 3.2 First page of the Portlet wizard
MyEclipse 6.5 provides following Portlet templates:
- Portlet with JSPs – this Portlet delegates all requests to JSPs corresponding to portlet mode. This allows clearer separation of the application logic from the UI and to leverage JSP support provided by MyEclipse IDE.
- Simple Portlet – this template will create simple Portlet class with method stubs for the request handling methods.
Second page of the wizard allows further customize your new portlet and to specify template-specific portlet settings:
Figure 3.3 Second page of the Portlet wizard
MyEclipse 6.5 does not current support direct deployment of the Portal Web Projects directly to a portal server. The reason for this is that each portlet server out there can have varying deployment requirements, and at the moment the deployment tool in MyEclipse doesn’t know how to deploy Portlets to those servers. This is something we want to improve in a future release.
To deploy portal application to JSR 168-compatible portal engine the project should be exported as deployable WAR file.
Figure 4.1 WAR export wizard
The resulting WAR file should be deployed to the portal server using the server-specific deployment tools or follow the specific deployment instructions provided by the portlet server.
How to know deploy portlet, here: How to deploy portletShare