| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <!-- |
| Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. |
| --> |
| <head> |
| |
| <!-- Use is subject to license terms.--> |
| <title>Using Portal Pack 3.0 Plugins to Create Portlets on NetBeans 6.5 IDE</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" > |
| <meta http-equiv="Content-Style-Type" content="text/css" > |
| <meta name="description" content="As a set of plugins for NetBeans (IDE), the Portal Pack plugins support full life-cycle of portlet application development inside NetBeans."> |
| <link rel="stylesheet" type="text/css" href="https://netbeans.org/netbeans.css"> |
| <link rel="stylesheet" href="../../netbeans.css"> |
| </head> |
| |
| |
| <body> |
| |
| <a name="top"></a> |
| <h1>Using Portal Pack 3.0 Plugins to Create Portlets on NetBeans 6.5 IDE</h1> |
| |
| <p>As a set of plugins for NetBeans (IDE), the Portal Pack plugins |
| support full life-cycle of portlet application development inside NetBeans. Using this tool portlet developers |
| can develop, package, deploy, and test portlets inside their NetBeans IDE. By automatic |
| code and Deployment Descriptor generation, this tool helps developers to develop portlets quickly.</p> |
| <p>Portal Pack plugins provide a tight integration with portal servers (such as the |
| WebSynergy Server, Liferay Portal Server, Sun Java System Portal Server 7.x, The OpenPortal |
| Portlet Container on java.net) to support deployment and undeployment of portlets on both |
| the local and remote servers.</p> |
| <p>The following are the topics covered in this article:</p> |
| <ul class="toc"> |
| <li><p><a href="">Configuring the WebSynergy Server</a></p> |
| <ul class="toc"> |
| <li><p><a href="#ghldj">To configure the WebSynergy Server</a></p></li> |
| <li><p><a href="#ghljq">To View Portlets Deployed on WebSynergy Server</a></p></li></ul> |
| </li> |
| <li><p><a href="#ghlmp">Creating Portlets using Portal Pack 3.0 Plugins</a></p> |
| <ul class="toc"> |
| <li><p><a href="#ghkzq">Creating a Project</a></p> |
| <ul class="toc"> |
| <li><p><a href="#ghkzd">To Create a Project</a></p></li></ul> |
| </li> |
| <li><p><a href="#ghkxz">Creating JSR168/286 Portlets and Portlet Pages</a></p> |
| <ul class="toc"> |
| <li><p><a href="#ghhmg">To Create a JSR168/286 Portlet</a></p></li> |
| <li><p><a href="#ghnch">To Deploy Portlets to WebSynergy Server</a></p></li> |
| <li><p><a href="#ghkcd">To Create a new JSR 168/286 Portlet</a></p></li></ul> |
| </li> |
| <li><p><a href="#ghhtg">Creating VisualWeb JSF Portlets and Pages</a></p> |
| <ul class="toc"> |
| <li><p><a href="#ghhlh">To Create a VisualWeb JSF Portlet</a></p></li> |
| <li><p><a href="#ghhqm">To Create a Edit or Help mode JSF Page</a></p></li></ul> |
| </li> |
| <li><p><a href="#ghhue">Creating Ruby/PHP/Groovy Portlets</a></p> |
| <ul class="toc"> |
| <li><p><a href="#ghjhz">To Create a Ruby Portlet</a></p></li> |
| <li><p><a href="#ghjkw">To Create a Edit Mode or Help Mode Ruby Portlet Page</a></p></li> |
| <li><p><a href="#ghjhw">To Create a PHP Portlet</a></p></li> |
| <li><p><a href="#ghjij">To Create a Edit Mode or Help Mode PHP Portlet Page</a></p></li> |
| <li><p><a href="#ghjjk">To Create a Groovy Portlet</a></p></li> |
| <li><p><a href="#ghjjz">To Create a Edit Mode or Help Mode Groovy Portlet Page</a></p></li></ul> |
| </li></ul> |
| </li> |
| <li><p><a href="#ghnqy">Related Links</a></p></li></ul> |
| |
| <p>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.</p> |
| <p>As a prerequisite for installing Project WebSynergy, you need to install <a href="http://java.sun.com/javase/downloads/index.jsp">JDK1.5</a> or |
| <a href="http://java.sun.com/javase/downloads/index.jsp">JDK1.6</a> on your machine. You can download the platform specific jar for Project WebSynergy from |
| <a href="http://portal.dev.java.net/">OpenPortal Community</a>. Install the Project WebSynergy bundle and start the server.</p> |
| <p>Download Portal Pack 3.0 plugins from <a href="http://portalpack.netbeans.org">http://portalpack.netbeans.org</a>.</p> |
| <p>To install the Portal Pack 3.0 plugins on the NetBeans 6.5 IDE:</p> |
| |
| <ol> |
| <li><p>Start the NetBeans IDE and choose <b>Tools</b> —> <b>Plugins</b>. The <b>Plugins</b> window pops up.</p></li> |
| <li><p>To add plugins from the download location, navigate to the <b>Downloaded</b> tab, and click the <b>Add Plugins...</b> button.</p></li> |
| <li><p>Click <b>Install</b> to start the installation.</p> |
| </li> |
| </ol> |
| |
| <a name="ghlij"></a> |
| |
| <h2>Configuring the WebSynergy Server</h2> |
| |
| <p>The portlets created using Portal Pack plugins can be deployed on Project WebSynergy. |
| The following topics are discussed in this section:</p> |
| <ul> |
| <li><p><a href="#ghldj">To configure the WebSynergy Server</a></p></li> |
| <li><p><a href="#ghljq">To View Portlets Deployed on WebSynergy Server</a></p></li> |
| </ul> |
| |
| <a name="ghldj"></a> |
| <p><b>To configure the WebSynergy Server</b></p> |
| <ol> |
| <li>Choose Servers from the Tools menu. |
| <p>The <b>Servers</b> window appears.</p> |
| <a name="ghlkm"></a> |
| <h6>Figure 1 Configuring the WebSynergy Server</h6> |
| <a href="../../images_www/articles/portalpack/Servers.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-Servers.gif" alt="Configuring the WebSynergy Server"><br>Click to Expand</a></li> |
| <li>Select the Project WebSynergy Server from the Servers list, and click the Add |
| Server button. |
| <p>The <b>Add Server Instance</b> window appears.</p> |
| <a name="ghlki"></a> |
| <h6>Figure 2 Configuring the WebSynergy Server</h6> |
| <a href="../../images_www/articles/portalpack/AddServer.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-AddServer.gif" alt="Configuring the WebSynergy Server"><br>Click to Expand</a></li> |
| <li>Select Project WebSynergy Server and click Next.</li> |
| <li>Click the button next to the GlassFish Home, to choose the GlassFish Home |
| directory. |
| <p>The <b>Choose Directory</b> window appears.</p></li> |
| <li>Navigate to the 'glassfish' folder on your desktop, and click 'OK'. |
| <p>The GlassFish Home, Domain Dir, Domain, Port, and Admin Port fields are populated.</p></li> |
| <li>Type the password in the Password field. |
| <p><b class="notes">Note:</b>The default password is <tt>adminadmin</tt>.</p> |
| <a name="ghlji"></a> |
| <h6>Figure 3 Configuring the WebSynergy Server</h6> |
| <a href="../../images_www/articles/portalpack/AddServerInstance.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-AddServerInstance.gif" alt="Configuring the WebSynergy Server"><br>Click to Expand</a></li> |
| <li>Click Next.</li> |
| <li>Click Finish. |
| <p>You have successfully configured your NetBeans IDE to deploy the portlets created on |
| it to your WebSynergy build.</p> |
| </li> |
| </ol> |
| |
| |
| <a name="ghljq"></a> |
| <p><b>To View the Portlets Deployed on WebSynergy Server</b></p> |
| <ol> |
| <li>Display the Services tab in the NetBeans IDE by clicking the tab name, |
| choosing 'Services' from the window menu, or pressing Ctrl-5.</li> |
| <li>Expand WebSynergy Server under Servers.</li> |
| <li>Expand 'Portlets'. |
| <p>To view a particular portlet, right-click the portlet name and choose <b>Show Portlet</b> from |
| the pop-up menu.</p> |
| <a name="ghukr"></a> |
| <h6>Figure 4 Viewing the portlets deployed to WebSynergy Server</h6> |
| <img src="../../images_www/articles/portalpack/ShowPortlet.gif" alt="Viewing the portlets deployed to WebSynergy Server" width="274" height="276" /> |
| </li> |
| </ol> |
| |
| <a name="ghlmp"></a> |
| |
| <h2>Creating Portlets by using Portal Pack 3.0 Plugins</h2> |
| |
| <p>You can create JSR 168/286 portlets, VisualWeb JSF portlets, and Ruby/PHP/Groovy portlets by |
| using Portal Pack 3.0 plugins on NetBeans IDE 6.5 software. To create portlets, |
| you need to create a Web Project with the Portlet Support framework. You |
| can have multiple portlets within a single Web Project.</p> |
| <p>The following topics are discussed in this section:</p> |
| <ul> |
| <li><p><a href="#ghkzq">Creating a Project</a></p></li> |
| <li><p><a href="#ghkxz">Creating JSR168/286 Portlets and Portlet Pages</a></p></li> |
| <li><p><a href="#ghhtg">Creating VisualWeb JSF Portlets and Pages</a></p></li> |
| <li><p><a href="#ghhue">Creating Ruby/PHP/Groovy Portlets</a></p></li> |
| </ul> |
| |
| |
| <div class="indent"> |
| <a name="ghkzq"></a><h3>Creating a Project</h3> |
| <p>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.</p> |
| |
| <a name="ghkzd"></a> |
| <p><b>To Create a Project</b></p> |
| |
| <ol> |
| <li>Choose New Project from the File menu. |
| <p>The New Project page appears.</p></li> |
| <li>Choose Java Web and Web Applications respectively for Categories and Projects, and click Next. |
| <a name="ghkzj"></a> |
| <h6>Figure 5 Creating a Project</h6> |
| <a href="../../images_www/articles/portalpack/NewProject.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-NewProject.gif" alt="Creating a Project"><br>Click to Expand</a></li> |
| <li>Specify a name for your project, and click Next. |
| <a name="ghkyu"></a> |
| <h6>Figure 6 Creating a Project</h6> |
| <a href="../../images_www/articles/portalpack/ProjectName.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-ProjectName.gif" alt="Creating a Project"><br>Click to Expand</a></li> |
| <li>Select the Project WebSynergy Server as the server instance from the Server drop-down |
| menu. |
| <a name="ghkzw"></a> |
| <h6>Figure 7 Creating a Project</h6> |
| <a href="../../images_www/articles/portalpack/ServerSettings.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-ServerSettings.gif" alt="Creating a Project"><br>Click to Expand</a></li> |
| <li>Select Portlet Support as the framework. |
| <p>Choose Portlet Version 2.0, select the Create Portlet option, and click Finish.</p> |
| <a name="ghmvw"></a> |
| <h6>Figure 8 Creating a Project</h6> |
| <a href="../../images_www/articles/portalpack/Frameworks.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-Frameworks.gif" alt="Creating a Project"><br>Click to Expand</a> |
| <p>Your new project is created. Also, a JSR168/286 portlet called <b>Hello World</b> is |
| also created by default.</p> |
| <a name="ghmsg"></a> |
| <h6>Figure 9 Creating a Project</h6> |
| <img src="../../images_www/articles/portalpack/HelloWorld.gif" alt="Creating a Project" width="327" height="328" /> |
| <p>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.</p> |
| </li> |
| </ol></div> |
| |
| |
| <div class="indent"> |
| <a name="ghkxz"></a><h3>Creating JSR168/286 Portlets and Portlet Pages</h3> |
| |
| <p>The NetBeans IDE 6.5 software creates a JSR168/286 portlet by default when you |
| create a new project in the NetBeans IDE.</p> |
| <p>The following topics are discussed in this section:</p> |
| <ul> |
| <li><p><a href="#ghhmg">To Create a JSR168/286 Portlet</a></p></li> |
| <li><p><a href="#ghnch">To Deploy Portlets to WebSynergy Server</a></p></li> |
| <li><p><a href="#ghkcd">To Create a new JSR 168/286 Portlet</a></p></li> |
| </ul> |
| |
| |
| |
| <a name="ghhmg"></a> |
| <p><b>To Create a JSR168/286 Portlet</b></p> |
| |
| <ol> |
| <li>The system by default, creates the Hello World portlet. |
| <p>You can use the Palette on the right corner of the project window |
| to make changes to the portlet. Make changes to the <tt>index.jsp</tt> page, by adding |
| objects from the Palette. The Palette contains HTML, HTML Forms, JSP, JSF, and |
| Database objects. On adding a palette object, the markup for the object is |
| added to the page. You can make changes to the markup, as |
| needed.</p> |
| <a name="ghmwm"></a> |
| <h6>Figure 10 Creating JSR168/286 Portlets and Portlet Pages</h6> |
| <a href="../../images_www/articles/portalpack/JSR168Palette.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-JSR168Palette.gif" alt="Creating JSR168/286 Portlets and Portlet Pages"><br>Click to Expand</a></li> |
| <li>Click Save from the File menu.</li> |
| </ol> |
| |
| |
| |
| <a name="ghnch"></a> |
| <p><b>To Deploy Portlets to WebSynergy Server</b></p> |
| |
| <ol> |
| <li>Right-click the project name and choose Run from the pop-up menu. |
| <a name="ghnbr"></a> |
| <h6>Figure 11 Deploying Portlets to WebSynergy Server</h6> |
| <img src="../../images_www/articles/portalpack/Run.gif" alt="Deploying Portlets to WebSynergy Server" width="294" height="248" /></li> |
| <li>Again, right-click on the project and choose Undeploy and Deploy from the pop-up |
| menu. |
| <a name="ghnce"></a> |
| <h6>Figure 12 Deploying Portlets to WebSynergy Server</h6> |
| <img src="../../images_www/articles/portalpack/Deploy.gif" alt="Deploying Portlets to WebSynergy Server" width="285" height="258" /></li> |
| <li>Click on the Services tab. |
| <p>The services tab displays all the projects and the associated portlets deployed on |
| WebSynergy Server. In this example, <tt>WebApplication1</tt> is the name of the project and <tt>HelloWorld</tt> |
| is the name of the portlet. You can find <tt>WebApplication1.HelloWorld</tt> under <tt>portlets</tt>.</p></li> |
| <li>Right-click the portlet name and select Show Portlet from the pop-up manu. |
| <p>In our example, right-click on <tt>WebApplication1.HelloWorld</tt>.</p> |
| <a name="ghncr"></a> |
| <h6>Figure 13 Deploying Portlets to WebSynergy Server</h6> |
| <img src="../../images_www/articles/portalpack/ShowPortlet.gif" alt="Deploying Portlets to WebSynergy Server" width="274" height="276" /> |
| <p>It opens the Project WebSynergy welcome page.</p> |
| <a name="ghnbm"></a> |
| <h6>Figure 14 Deploying Portlets to WebSynergy Server</h6> |
| <a href="../../images_www/articles/portalpack/WebSynergy.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-WebSynergy.gif" alt="Deploying Portlets to WebSynergy Server"><br>Click to Expand</a></li> |
| <li>Login to Project WebSynergy and choose Add Application from the main menu. |
| <a name="ghnbh"></a> |
| <h6>Figure 15 Deploying Portlets to WebSynergy Server</h6> |
| <img src="../../images_www/articles/portalpack/AddApplication.gif" alt="Deploying Portlets to WebSynergy Server" width="191" height="302" /> |
| <p>The Add Application window appears.</p> |
| <a name="ghnas"></a> |
| <h6>Figure 16 Deploying Portlets to WebSynergy Server</h6> |
| <img src="../../images_www/articles/portalpack/User_Portlets.gif" alt="Deploying Portlets to WebSynergy Server" width="262" height="579" /></li> |
| <li>Click on User_Portlets to expand the list of user created portlets.</li> |
| <li>Click the Add button next to the HelloWorldPortlet entry. |
| <p>The HelloWorldPortlet is added to the application.</p> |
| <a name="ghnqk"></a> |
| <h6>Figure 17 Deploying Portlets to WebSynergy Server</h6> |
| <img src="../../images_www/articles/portalpack/HelloWorldPortlet.gif" alt="Deploying Portlets to WebSynergy Server" width="592" height="477" /></li> |
| </ol> |
| |
| <a name="ghkcd"></a> |
| <p><b>To Create a new JSR 168/286 Portlet</b></p> |
| |
| <ol> |
| <li>Right click the project name, and choose New —> Other, or press Ctrl+N. |
| <a name="ghnag"></a> |
| <h6>Figure 18 Creating a new JSR 168/286 Portlet</h6> |
| <img src="../../images_www/articles/portalpack/Other.gif" alt="Creating a new JSR 168/286 Portlet" width="520" height="550" /> |
| <p> The New File window appears.</p> |
| <a name="ghnai"></a> |
| <h6>Figure 19 Creating a new JSR 168/286 Portlet</h6> |
| <a href="../../images_www/articles/portalpack/NewFilePortlet.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-NewFilePortlet.gif" alt="Creating a new JSR 168/286 Portlet"><br>Click to Expand</a></li> |
| <li>Select 'Portlets' in the 'Categories' list and 'Portlet' in the 'File Types' list, |
| and click Next. |
| <p>The New Portlet window appears.</p> |
| <a name="ghnbc"></a> |
| <h6>Figure 20 Creating a new JSR 168/286 Portlet</h6> |
| <a href="../../images_www/articles/portalpack/SamplePortlet.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-SamplePortlet.gif" alt="Creating a new JSR 168/286 Portlet"><br>Click to Expand</a></li> |
| <li>Specify a name for the portlet and click Next. |
| <p>To create Edit and Help mode portlet pages, leave the EDIT and HELP options |
| selected.</p></li> |
| <li>Click Finish. |
| <p>The New File window appears.</p></li> |
| <li>Select the 'Create Jsps' option and click Finish. |
| <a name="ghnft"></a> |
| <h6>Figure 21 Creating a new JSR 168/286 Portlet</h6> |
| <a href="../../images_www/articles/portalpack/Create_jsps.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-Create_jsps.gif" alt="Creating a new JSR 168/286 Portlet"><br>Click to Expand</a> |
| <p>The <tt><class-name>.java</tt> file is created.</p> |
| <a name="ghneo"></a> |
| <h6>Figure 22 Creating a new JSR 168/286 Portlet</h6> |
| <a href="../../images_www/articles/portalpack/portlet-java.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-portlet-java.gif" alt="Creating a new JSR 168/286 Portlet"><br>Click to Expand</a> |
| <p>The files are listed under <tt>WEB-INF/jsp</tt>.</p> |
| <a name="ghngj"></a> |
| <h6>Figure 23 Creating a new JSR 168/286 Portlet</h6> |
| <img src="../../images_www/articles/portalpack/jsps.gif" alt="Creating a new JSR 168/286 Portlet" width="252" height="242" /></li> |
| <li>To edit a file, right-click the file name and choose Open from the |
| pop-up menu. |
| <a name="ghndn"></a> |
| <h6>Figure 24 Creating a new JSR 168/286 Portlet</h6> |
| <img src="../../images_www/articles/portalpack/open-jsp.gif" alt="Creating a new JSR 168/286 Portlet" width="365" height="269" /> |
| <p>An edit window containing the file content is displayed.</p> |
| <a name="ghndl"></a> |
| <h6>Figure 25 Creating a new JSR 168/286 Portlet</h6> |
| <a href="../../images_www/articles/portalpack/open-file.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-open-file.gif" alt="Creating a new JSR 168/286 Portlet"><br>Click to Expand</a></li> |
| <li>When you have finished making changes, choose Save from the File menu.</li> |
| <li>Run and deploy the portlet. |
| <p>To find out how to run and deploy portlets, see <a href="#ghnch">To Deploy portlets to WebSynergy Server</a>.</p> |
| </li> |
| </ol></div> |
| |
| |
| <div class="indent"> |
| <a name="ghhtg"></a><h3>Creating VisualWeb JSF Portlets and Pages</h3> |
| |
| <p>When you are creating a JSF portlet, a JSF page is created |
| along with it. It is possible to create more portlet pages for the |
| same portlet.</p> |
| <ul> |
| <li><p><a href="#ghhlh">To Create a VisualWeb JSF Portlet</a></p></li> |
| <li><p><a href="#ghhqm">To Create a Edit or Help mode JSF Page</a></p></li> |
| </ul> |
| |
| <a name="ghhlh"></a> |
| <p><b>To Create a VisualWeb JSF Portlet</b></p> |
| |
| <ol> |
| <li>Right-click the project name and choose New —> VisualWeb JSF Portlet Page.</li> |
| <li>Specify the file and folder name.</li> |
| <li>Select the Create a New Portlet option, and specify the name of the |
| portlet, as shown in the figure. |
| <p>In the example, the name of the portlet is <code>NewJSFportlet</code>, and the name |
| of the portlet is <code>PortletPage1</code>. 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.</p> |
| <a name="ghmxc"></a> |
| <h6>Figure 26 Creating a VisualWeb JSF Portlet</h6> |
| <a href="../../images_www/articles/portalpack/jsfPortletPage.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-jsfPortletPage.gif" alt="Creating a VisualWeb JSF Portlet"><br>Click to Expand</a></li> |
| <li>Click Finish. |
| <p>You can see that the JSF portlet (in the example, <code>NewJSFportlet</code>) and the |
| JSP file for the portlet page (in the example, <code>PortletPage1</code>) are listed under <tt>portlet.xml</tt>. |
| By default, the portlet page is set to View Mode.</p> |
| <a name="ghmxe"></a> |
| <h6>Figure 27 Creating a VisualWeb JSF Portlet</h6> |
| <img src="../../images_www/articles/portalpack/NewJSFportlet.gif" alt="Creating a VisualWeb JSF Portlet" width="268" height="441" /></li> |
| <li>Design your portlet page by using the options available on the palette. |
| <a name="ghmwd"></a> |
| <h6>Figure 28 Creating a VisualWeb JSF Portlet</h6> |
| <a href="../../images_www/articles/portalpack/jsfPortletPalette.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-jsfPortletPalette.gif" alt="Creating a VisualWeb JSF Portlet"><br>Click to Expand</a></li> |
| <li>Choose Save from the File menu.</li> |
| <li>Run and Deploy the portlet to WebSynergy. |
| <p>To find out how to run and deploy portlets, see <a href="#ghnch">To Deploy portlets to WebSynergy Server</a>.</p> |
| </li> |
| </ol> |
| |
| |
| <a name="ghhqm"></a> |
| <p><b>To Create an Edit or Help Mode JSF Page</b></p> |
| |
| <ol> |
| <li>Right-click the project name, and choose New —> VisualWeb JSF Portlet Page. |
| <p><b class="notes">Note: </b>When you select the <b>Create a New Portlet</b> 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.</p> |
| </li> |
| <li>Specify the file name and the folder name. |
| <a name="ghkck"></a> |
| <h6>Figure 29 Creating an Edit or Help Mode JSF Page</h6> |
| <a href="../../images_www/articles/portalpack/jsfPortletPage1.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-jsfPortletPage1.gif" alt="Creating an Edit or Help Mode JSF Page"><br>Click to Expand</a></li> |
| <li>Click Finish. |
| <p>The new JSP file <tt>PortletPage2.jsp</tt> has been created. It is listed under |
| the <b>Web Pages</b> folder.</p> |
| <a name="ghncg"></a> |
| <h6>Figure 30 Creating an Edit or Help Mode JSF Page</h6> |
| <img src="../../images_www/articles/portalpack/PortletPage2.gif" alt="Creating an Edit or Help Mode JSF Page" width="270" height="468" /></li> |
| <li>Set the portlet page as an Edit Mode or Help Mode page.<ol style="list-style-type: lower-alpha"> |
| |
| <li>The following is the procedure to set a portlet page for Edit Mode:<ol style="list-style-type: lower-roman"> |
| <li>Right-click the JSP file name. |
| <p>Choose Set as Initial Page > New JSF Portlet, and then select either Edit Mode Page or Help Mode Page.</p> |
| <a name="ghndc"></a> |
| <h6>Figure 31 Creating an Edit or Help Mode JSF Page</h6> |
| <img src="../../images_www/articles/portalpack/EditMode.gif" alt="Creating an Edit or Help Mode JSF Page" width="483" height="476" /> |
| <p>The portlet page <tt>PortletPage2.jsp</tt> is now associated to the portlet <tt>NewJSFportlet</tt> and listed |
| under <tt>portlet.xml</tt>.</p> |
| <a name="ghncd"></a> |
| <h6>Figure 32 Creating an Edit or Help Mode JSF Page</h6> |
| <img src="../../images_www/articles/portalpack/EditModePage.gif" alt="Creating an Edit or Help Mode JSF Page" width="250" height="250" /> |
| <p><b class="notes">Note:</b> Even when you delete a portlet page, the portlet entry remains in the |
| <tt>portlet.xml</tt> file. For this, you need to manually delete the portlet entry from |
| the portlet.xml file.</p> |
| </li> |
| </ol> |
| </li> |
| <li>The following is the procedure to set a portlet page for Help Mode:<ol style="list-style-type: lower-roman"> |
| <li>Right-click on the JSP file and navigate to select the Help Mode Page |
| radio-button. |
| <a name="ghncw"></a> |
| <h6>Figure 33 Creating an Edit or Help Mode JSF Page</h6> |
| <img src="../../images_www/articles/portalpack/HelpMode.gif" alt="Creating an Edit or Help Mode JSF Page" width="500" height="473" /> |
| <p>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 <tt>PortletPage2.jsp</tt> is associated to the portlet <tt>NewJSFportlet</tt>. You can |
| find it under <tt>portlet.xml</tt>.</p> |
| <a name="ghnco"></a> |
| <h6>Figure 34 Creating an Edit or Help Mode JSF Page</h6> |
| <img src="../../images_www/articles/portalpack/HelpModePage.gif" alt="Creating an Edit or Help Mode JSF Page" width="228" height="294" /></li> |
| </ol> |
| </li> |
| </ol> |
| </li> |
| <li>Design your portlet page, by using the options available on the palette.</li> |
| <li>Choose Save from the File menu.</li> |
| </ol> |
| </div> |
| |
| |
| <div class="indent"> |
| <a name="ghhue"></a><h3>Creating Ruby/PHP/Groovy Portlets</h3> |
| |
| <p>The NetBeans IDE 6.5 software gives you the option to create portlets using |
| Ruby, PHP, and Groovy programming languages.</p> |
| <p>The following sections explain the procedures to create Ruby, PHP, and Groovy portlets |
| and portlet pages:</p> |
| <ul> |
| <li><p><a href="#ghjhz">To Create a Ruby Portlet</a></p></li> |
| <li><p><a href="#ghjkw">To Create a Edit Mode or Help Mode Ruby Portlet Page</a></p></li> |
| <li><p><a href="#ghjhw">To Create a PHP Portlet</a></p></li> |
| <li><p><a href="#ghjij">To Create a Edit Mode or Help Mode PHP Portlet Page</a></p></li> |
| <li><p><a href="#ghjjk">To Create a Groovy Portlet</a></p></li> |
| <li><p><a href="#ghjjz">To Create a Edit Mode or Help Mode Groovy Portlet Page</a></p></li> |
| </ul> |
| |
| <a name="ghjhz"></a> |
| <p><b>To Create a Ruby Portlet</b></p> |
| |
| <ol> |
| <li>Right-click the project name and choose New —> Other from the pop-up menu, |
| or press Ctrl-N. |
| <a name="ghncc"></a> |
| <h6>Figure 35 Creating a Ruby Portlet</h6> |
| <img src="../../images_www/articles/portalpack/Other.gif" alt="Creating a Ruby Portlet" width="520" height="550" /> |
| <p> The New File window appears.</p> |
| <a name="ghnar"></a> |
| <h6>Figure 36 Creating a Ruby Portlet</h6> |
| <a href="../../images_www/articles/portalpack/NewFile.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-NewFile.gif" alt="Creating a Ruby Portlet"><br>Click to Expand</a></li> |
| <li>Select WebSynergy Portlets from the Categories list and Ruby Portlet as the file |
| type, and click Next. |
| <p>The New Portlet window appears.</p></li> |
| <li>Specify the file, folder, and portlet name. |
| <a name="ghkcm"></a> |
| <h6>Figure 37 Creating a Ruby Portlet</h6> |
| <a href="../../images_www/articles/portalpack/RubyPortlet.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-RubyPortlet.gif" alt="Creating a Ruby Portlet"><br>Click to Expand</a> |
| <p>A folder named <code>ruby</code> is created under the <code>WEB-INF</code> folder in the project. |
| The ruby folder contains two files related to the portlet, named in the |
| pattern <tt><ruby-portlet>.rb</tt> and <tt><ruby-portlet>_action.rb</tt>. The <tt><ruby-portlet>.rb</tt> file is also listed under <tt>portlet.xml</tt>.</p> |
| <a name="ghnbv"></a> |
| <h6>Figure 38 Creating a Ruby Portlet</h6> |
| <a href="../../images_www/articles/portalpack/Project_ruby.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-Project_ruby.gif" alt="Creating a Ruby Portlet"><br>Click to Expand</a></li> |
| <li>Click Finish |
| <p>A Ruby portlet is created in View Mode.</p></li> |
| <li>Edit and make changes to the <tt><ruby-portlet>.rb</tt> and <tt><ruby-portlet>_action.rb</tt> files. |
| <p>The<tt> <ruby-portlet>_action.rb</tt> file is executed whenever an action occurs in the project that contains |
| the ruby portlet.</p></li> |
| <li>Choose Save from the File menu.</li> |
| <li>Run and deploy the portlet to WebSynergy. |
| <p>For information about how to run and deploy portlets, see <a href="#ghnch">To Deploy portlets to WebSynergy Server</a>.</p> |
| </li> |
| </ol> |
| |
| |
| <a name="ghjkw"></a> |
| <p><b>To Create an Edit Mode or Help Mode Ruby Portlet</b></p> |
| |
| <ol> |
| <li>Select Ruby Portlet as the file type, and click Next.</li> |
| <li>Specify a file name and folder name. |
| |
| <p><b class="notes">Note: </b>When you are creating only a portlet page, leave the <b>Create a New Portlet</b> checkbox |
| unchecked.</p> |
| |
| <a name="ghkwi"></a> |
| <h6>Figure 39 Creating an Edit Mode or Help Mode Ruby Portlet</h6> |
| <a href="../../images_www/articles/portalpack/RubyPortletPage.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-RubyPortletPage.gif" alt="Creating an Edit Mode or Help Mode Ruby Portlet"><br>Click to Expand</a></li> |
| <li>Click Finish. |
| <p>The <tt><ruby-portlet>.rb</tt> file is created and appears under the <code>Ruby</code> folder.</p> |
| <p><b class="notes">Note: </b>The <tt>portlet.xml</tt> file stores the details of the portlet and the portlet page. |
| Any accidental deletion of the <tt>portlet.xml</tt> 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 <code>Invalid Portlet Name</code>.</p> |
| |
| <a name="ghkxj"></a> |
| <h6>Figure 40 Creating an Edit Mode or Help Mode Ruby Portlet</h6> |
| <a href="../../images_www/articles/portalpack/InvalidPortlet.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-InvalidPortlet.gif" alt="Creating an Edit Mode or Help Mode Ruby Portlet"><br>Click to Expand</a></li> |
| <li>Set the portlet page to Edit or Help mode. |
| <p>For the details of the procedure to set a portlet to Edit or |
| Help mode, refer to the section on <a href="#ghhqm">Creating a Edit or Help Mode JSF Page</a>.</p></li> |
| <li>Edit and make changes to the <tt><ruby-portlet>.rb</tt> file.</li> |
| <li>When you have finished making changes, choose Save from the File menu.</li> |
| </ol> |
| |
| |
| |
| <a name="ghjhw"></a> |
| <p><b>To Create a PHP Portlet</b></p> |
| |
| <ol> |
| <li>Right-click the project name and choose New —> Other from the pop-up menu, |
| or press Ctrl-N. |
| <a name="ghnae"></a> |
| <h6>Figure 41 Creating a PHP Portlet</h6> |
| <img src="../../images_www/articles/portalpack/Other.gif" alt="Creating a PHP Portlet" width="520" height="550" /> |
| <p> The New File window appears.</p> |
| <a name="ghnbs"></a> |
| <h6>Figure 42 Creating a PHP Portlet</h6> |
| <a href="../../images_www/articles/portalpack/NewFilePHP.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-NewFilePHP.gif" alt="Creating a PHP Portlet"><br>Click to Expand</a></li> |
| <li>Select WebSynergy Portlets from the Categories list and PHP Portlet as the file |
| type, and click Next.</li> |
| <li>Specify the file, folder, and portlet name. |
| <a name="ghkya"></a> |
| <h6>Figure 43 Creating a PHP Portlet</h6> |
| <a href="../../images_www/articles/portalpack/PHPportlet.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-phpPortlet.gif" alt="Creating a PHP Portlet"><br>Click to Expand</a></li> |
| <li>Click Finish. |
| <p>The <tt>index.php</tt> and <tt><php-portlet>.php</tt> files are created and appear under the <code>resources</code> |
| folder. The <tt>index.php</tt> page should not be deleted for the portlet to work. |
| The <tt><php-portlet>.php</tt> file has View Mode.</p> |
| <a name="ghnbp"></a> |
| <h6>Figure 44 The Newly Created PHP Portlet file</h6> |
| <img src="../../images_www/articles/portalpack/new-php-portlet.gif" alt="Creating a PHP Portlet" width="282" height="334" /></li> |
| <li>Edit the <tt><php-portlet>.php</tt> page, as needed. |
| <p>You can use the HTML and the HTML Forms objects from the palette |
| in modifying the page.</p> |
| <a name="ghnqv"></a> |
| <h6>Figure 45 Creating a PHP Portlet</h6> |
| <img src="../../images_www/articles/portalpack/phpPalette.gif" alt="Creating a PHP Portlet" width="265" height="255" /></li> |
| <li>When you have finished making changes, choose Save from the File menu.</li> |
| <li>Run and deploy the portlet to WebSynergy. |
| <p>For information on how to run and deploy portlets, see <a href="#ghnch">To Deploy portlets to WebSynergy Server</a>.</p> |
| </li> |
| </ol> |
| |
| |
| <a name="ghjij"></a> |
| <p><b>To Create an Edit Mode or Help Mode PHP Portlet Page</b></p> |
| |
| <ol> |
| <li>Follow steps 1 to 3 of the procedure on <a href="#ghjhw">Creating a PHP Portlet</a>, with the |
| exception of leaving the Creating a New Portlet checkbox unchecked. |
| <a name="ghnax"></a> |
| <h6>Figure 46 Creating an Edit Mode or Help Mode PHP Portlet Page</h6> |
| <a href="../../images_www/articles/portalpack/phpPortletPage.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-phpPortletPage.gif" alt="Creating an Edit Mode or Help Mode PHP Portlet Page"><br>Click to Expand</a></li> |
| <li>Click Finish. |
| <p>The <tt><php-portlet>.php</tt> file is created under the <code>resources</code> folder.</p> |
| <a name="ghnbb"></a> |
| <h6>Figure 47 Creating an Edit Mode or Help Mode PHP Portlet Page</h6> |
| <img src="../../images_www/articles/portalpack/phpPortletPage1.gif" alt="Creating an Edit Mode or Help Mode PHP Portlet Page" width="337" height="378" /></li> |
| <li>Set the portlet page to Edit or Help mode. |
| <p>For the details of the procedure to set a portlet to Edit or |
| Help mode, refer to the section on <a href="#ghhqm">Creating a Edit or Help Mode JSF Page</a>.</p></li> |
| <li>Edit the <tt><php-portlet>.php</tt> page, as needed. |
| <p>You can use the HTML and HTML Forms objects from the palette in creating |
| the php page.</p></li> |
| <li>When you have finished making changes, choose Save from the File menu.</li> |
| </ol> |
| |
| <a name="ghjjk"></a> |
| <p><b>To Create a Groovy Portlet</b></p> |
| |
| <ol> |
| <li>Right-click the project name, and choose New —> Other from the file menu, |
| or press Ctrl-N. |
| <a name="ghnbu"></a> |
| <h6>Figure 48 Creating a Groovy Portlet</h6> |
| <img src="../../images_www/articles/portalpack/Other.gif" alt="Creating a Groovy Portlet" width="520" height="550" /> |
| <p> The New File window appears.</p> |
| <a name="ghnbl"></a> |
| <h6>Figure 49 Creating a Groovy Portlet</h6> |
| <a href="../../images_www/articles/portalpack/NewFileGroovy.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-NewFileGroovy.gif" alt="Creating a Groovy Portlet"><br>Click to Expand</a></li> |
| <li>Select WebSynergy Portlets from the Categories list and Groovy Portlet as the file |
| type, and click Next.</li> |
| <li>Specify the file, folder, and portlet name. |
| <a name="ghnaq"></a> |
| <h6>Figure 50 Creating a Groovy Portlet</h6> |
| <a href="../../images_www/articles/portalpack/groovyPortlet.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-groovyPortlet.gif" alt="Creating a Groovy Portlet"><br>Click to Expand</a></li> |
| <li>Click Finish. |
| <p>The <code>Groovy</code> folder is created and appears under the <code>WEB-INF</code> folder in the project. |
| The Groovy folder contains the <tt><groovy-portlet>.groovy</tt> and <tt><groovy-portlet>.action.groovy</tt> files. The <tt><groovy-portlet>.action.groovy</tt> file |
| is executed whenever some action occurs in the project.</p> |
| <a name="ghnnl"></a> |
| <h6>Figure 51 Creating a Groovy Portlet</h6> |
| <img src="../../images_www/articles/portalpack/Ruby_portlet.gif" alt="Creating a Groovy Portlet" width="359" height="405" /></li> |
| <li>Edit the <tt><groovy-portlet>.groovy</tt> and the <tt><groovy-portlet>_action.groovy</tt> files, as needed.</li> |
| <li>Click Save from the File menu.</li> |
| <li>Run and deploy the portlet to WebSynergy. |
| <p>For information about how to run and deploy portlets, see <a href="#ghnch">To Deploy portlets to WebSynergy Server</a>.</p> |
| </li> |
| </ol> |
| |
| |
| <a name="ghjjz"></a> |
| <p><b>To Create an Edit Mode or Help mode Groovy Portlet Page</b></p> |
| |
| <ol> |
| <li>Follow steps 1 to 3 of the procedure on <a href="#ghjjk">Creating a Groovy Portlet</a>, with the |
| exception of leaving the Creating a New Portlet checkbox unchecked. |
| <a name="ghnbt"></a> |
| <h6>Figure 52 Creating an Edit Mode or Help mode Groovy Portlet Page</h6> |
| <a href="../../images_www/articles/portalpack/groovyPortletPage.gif" target="_blank"><img src="../../images_www/articles/portalpack/thumb-groovyPortletPage.gif" alt="Creating an Edit Mode or Help mode Groovy Portlet Page"><br>Click to Expand</a></li> |
| <li>Click Finish. |
| <p>The <tt><groovy-portlet>.groovy</tt> file is created under the <code>Groovy</code> folder.</p> |
| <a name="ghnoo"></a> |
| <h6>Figure 53 Creating an Edit Mode or Help mode Groovy Portlet Page</h6> |
| <img src="../../images_www/articles/portalpack/GroovyPage.gif" alt="Creating an Edit Mode or Help mode Groovy Portlet Page" width="249" height="124" /></li> |
| <li>Set the portlet page to Edit or Help mode. |
| <p>For the details of the procedure to set a portlet to Edit or |
| Help mode, refer to the section on <a href="#ghhqm">Creating a Edit or Help Mode JSF Page</a>.</p></li> |
| <li>Edit and make changes to the <tt>groovy-portlet>.groovy</tt> file.</li> |
| <li>Click Save from the File menu.</li> |
| </ol> |
| </div> |
| |
| <a name="ghnqy"></a> |
| |
| <div class="feedback-box"> |
| <a href="/about/contact_form.html?to=3&subject=Feedback: Using Portal Pack 3.0 Plugins to Create Portlets">Send Feedback on This Tutorial</a> |
| </div> |
| <br style="clear:both;"> |
| <h2>Related Links</h2> |
| |
| <ul> |
| <li><p><a href="http://portalpack.netbeans.org">NetBeans Portal Pack Community</a></p></li> |
| <li><p><a href="http://portal.dev.java.net/">OpenPortal Community</a></p></li> |
| <li><p><a href="http://wiki.java.net/bin/view/OpenPortal/PortalPack">Community Wiki for Portal Pack Project</a></p></li> |
| <li><p><a href="http://blogs.oracle.com/portal/">Portal Post – The Sun Java System Portal Server Product and Technologies Group Weblog</a></p></li> |
| </ul> |
| |
| </body> |
| </html> |