Académique Documents
Professionnel Documents
Culture Documents
0 Plugins to Crea…
Search:
To View Portlets Deployed on WebSynergy Server Get Sun Software Service Plan
Now
Related Links
This article discusses creating portlets on the NetBeans by using Portal Pack 3.0 plugins, and deploying them on Project
WebSynergy. As a prerequisite, you need to download and install the Project WebSynergy bundle. Also, Portal Pack 3.0
plugins need to be installed on the NetBeans 6.5 IDE software.
As a prerequisite for installing Project WebSynergy, you need to install JDK1.5 or JDK1.6 on your machine. You can
download the platform specific jar for Project WebSynergy from OpenPortal C ommunity. Install the Project WebSynergy
bundle and start the server.
To install the Portal Pack 3.0 plugins on the NetBeans 6.5 IDE:
1. Start the NetBeans IDE and choose Tools —> Plugins. The Plugins window pops up.
2. To add plugins from the download location, navigate to the Downloaded tab, and click the Add Plugins... button.
netbeans.org/kb/…/portalpack.html 1/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
1. C hoose Servers from the Tools menu.
The Servers window appears.
C lick to Expand
2. Select the Project WebSynergy Server from the Servers list, and click the Add Server button.
The Add Server Instance window appears.
C lick to Expand
4. C lick the button next to the GlassFish Home, to choose the GlassFish Home directory.
The Choose Directory window appears.
C lick to Expand
7. C lick Next.
8. C lick Finish.
You have successfully configured your NetBeans IDE to deploy the portlets created on it to your WebSynergy
build.
1. Display the Services tab in the NetBeans IDE by clicking the tab name, choosing 'Services' from the window menu,
netbeans.org/kb/…/portalpack.html 2/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
or pressing C trl-5.
3. Expand 'Portlets'.
To view a particular portlet, right-click the portlet name and choose Show Portlet from the pop-up menu.
C reating a Project
Creating a Project
You can create and delete projects within the NetBeans IDE. A project acts as a container for portlets and portlet
pages, and all other files related to them.
To Create a Project
2. Choose Java Web and Web Applications respectively for C ategories and Projects, and click Next.
Click to Expand
netbeans.org/kb/…/portalpack.html 3/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
Click to Expand
4. Select the Project WebSynergy Server as the server instance from the Server drop-down menu.
Click to Expand
Click to Expand
Your new project is created. Also, a JSR168/286 portlet called Hello World is also created by default.
netbeans.org/kb/…/portalpack.html 4/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
Whenever you create a new portlet page, or when you open an existing portlet page, it opens in a new tab in
the NetBeans IDE. You can view and edit the page in full-screen mode or in regular window by double-clicking
the tab, or by clicking the Maximize Window button.
Click to Expand
1. Right-click the project name and choose Run from the pop-up menu.
2. Again, right-click on the project and choose Undeploy and Deploy from the pop-up menu.
netbeans.org/kb/…/portalpack.html 5/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
4. Right-click the portlet name and select Show Portlet from the pop-up manu.
In our example, right-click on WebApplication1.HelloWorld.
Click to Expand
5. Login to Project WebSynergy and choose Add Application from the main menu.
netbeans.org/kb/…/portalpack.html 6/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
netbeans.org/kb/…/portalpack.html 7/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
1. Right click the project name, and choose New —> Other, or press C trl+N.
netbeans.org/kb/…/portalpack.html 8/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
Click to Expand
2. Select 'Portlets' in the 'C ategories' list and 'Portlet' in the 'File Types' list, and click Next.
The New Portlet window appears.
Click to Expand
4. Click Finish.
The New File window appears.
Click to Expand
The <class-name>.java file is created.
netbeans.org/kb/…/portalpack.html 9/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
Click to Expand
The files are listed under WEB-INF/jsp.
6. To edit a file, right-click the file name and choose Open from the pop-up menu.
Click to Expand
7. When you have finished making changes, choose Save from the File menu.
netbeans.org/kb/…/portalpack.html 10/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
To C reate a Edit or Help mode JSF Page
1. Right-click the project name and choose New —> VisualWeb JSF Portlet Page.
3. Select the Create a New Portlet option, and specify the name of the portlet, as shown in the figure.
In the example, the name of the portlet is NewJSFportlet, and the name of the portlet is PortletPage1. By
default, the portlet display name, the description, and the title are the same as the portlet name, but you can
set different values for these attributes.
Click to Expand
4. Click Finish.
You can see that the JSF portlet (in the example, NewJSFportlet) and the JSP file for the portlet page (in the
example, PortletPage1) are listed under portlet.xml. By default, the portlet page is set to View Mode.
5. Design your portlet page by using the options available on the palette.
netbeans.org/kb/…/portalpack.html 11/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
Click to Expand
1. Right-click the project name, and choose New —> VisualWeb JSF Portlet Page.
Note: When you select the Create a New Portlet option, it prompts the system to create a new
portlet, along with creating a portlet page. You need to leave the checkbox unchecked to create only a page.
The fields, such as the portlet name, portlet display name, and the portlet title are disabled when the checkbox
is unchecked.
Click to Expand
3. Click Finish.
The new JSP file PortletPage2.jsp has been created. It is listed under the Web Pages folder.
netbeans.org/kb/…/portalpack.html 12/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
The portlet page PortletPage2.jsp is now associated to the portlet NewJSFportlet and listed under
portlet.xml.
netbeans.org/kb/…/portalpack.html 13/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
Note: Even when you delete a portlet page, the portlet entry remains in the portlet.xml
file. For this, you need to manually delete the portlet entry from the portlet.xml file.
b. The following is the procedure to set a portlet page for Help Mode:
i. Right-click on the JSP file and navigate to select the Help Mode Page radio-button.
Now, the same JSF portlet page is set to Help Mode. A single portlet page can be associated with
more than one portlet. You can assign a different mode for the portlet page for different portlets.
In our example, the portlet page PortletPage2.jsp is associated to the portlet NewJSFportlet. You
can find it under portlet.xml.
5. Design your portlet page, by using the options available on the palette.
The following sections explain the procedures to create Ruby, PHP, and Groovy portlets and portlet pages:
1. Right-click the project name and choose New —> Other from the pop-up menu, or press C trl-N.
Click to Expand
2. Select WebSynergy Portlets from the C ategories list and Ruby Portlet as the file type, and click Next.
The New Portlet window appears.
netbeans.org/kb/…/portalpack.html 15/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
Click to Expand
A folder named ruby is created under the WEB-INF folder in the project. The ruby folder contains two files related
to the portlet, named in the pattern <ruby-portlet>.rb and <ruby-portlet>_action.rb. The <ruby-portlet>.rb file
is also listed under portlet.xml.
Click to Expand
4. Click Finish
A Ruby portlet is created in View Mode.
Click to Expand
3. Click Finish.
The <ruby-portlet>.rb file is created and appears under the Ruby folder.
netbeans.org/kb/…/portalpack.html 16/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
Note: The portlet.xml file stores the details of the portlet and the portlet page. Any accidental deletion
of the portlet.xml file, leads to some issues in creating a portlet page. As shown in the below figure, when you
are trying to create a portlet page, you may see an error on the screen, saying Invalid Portlet Name.
Click to Expand
6. When you have finished making changes, choose Save from the File menu.
1. Right-click the project name and choose New —> Other from the pop-up menu, or press C trl-N.
netbeans.org/kb/…/portalpack.html 17/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
Click to Expand
2. Select WebSynergy Portlets from the C ategories list and PHP Portlet as the file type, and click Next.
Click to Expand
4. Click Finish.
The index.php and <php-portlet>.php files are created and appear under the resources folder. The index.php
page should not be deleted for the portlet to work. The <php-portlet>.php file has View Mode.
netbeans.org/kb/…/portalpack.html 18/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
6. When you have finished making changes, choose Save from the File menu.
1. Follow steps 1 to 3 of the procedure on C reating a PHP Portlet, with the exception of leaving the Creating a New
Portlet checkbox unchecked.
Click to Expand
2. Click Finish.
The <php-portlet>.php file is created under the resources folder.
5. When you have finished making changes, choose Save from the File menu.
netbeans.org/kb/…/portalpack.html 19/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
1. Right-click the project name, and choose New —> Other from the file menu, or press Ctrl-N.
Click to Expand
2. Select WebSynergy Portlets from the C ategories list and Groovy Portlet as the file type, and click Next.
Click to Expand
4. Click Finish.
The Groovy folder is created and appears under the WEB-INF folder in the project. The Groovy folder contains the
<groovy-portlet>.groovy and <groovy-portlet>.action.groovy files. The <groovy-portlet>.action.groovy file is
netbeans.org/kb/…/portalpack.html 20/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
<groovy-portlet>.groovy and <groovy-portlet>.action.groovy files. The <groovy-portlet>.action.groovy file is
executed whenever some action occurs in the project.
1. Follow steps 1 to 3 of the procedure on C reating a Groovy Portlet, with the exception of leaving the Creating a
New Portlet checkbox unchecked.
Click to Expand
2. Click Finish.
The <groovy-portlet>.groovy file is created under the Groovy folder.
netbeans.org/kb/…/portalpack.html 21/22
11/03/2009 Using Portal Pack 3.0 Plugins to Crea…
Related Links
NetBeans Portal Pack C ommunity
OpenPortal C ommunity
Portal Post – The Sun Java System Portal Server Product and Technologies Group Weblog
Shop SiteMap About Us C ontact Legal By us e of this webs ite, you agree to the Ne tBea ns Po licie s and Term s o f Use
Sponsored by
C ompanion
Projects:
netbeans.org/kb/…/portalpack.html 22/22