Labels

Learn the powerful enterprise adaptable database:

Getting Started With ADABAS & Natural

Sunday, March 17, 2013

Liferay 6.1: Creating a portlet

This tutorial is based on http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/creating-a-portl-3 and it is assumed that your Liferay IDE is setup according to http://setup-steps.blogspot.com/2013/03/eclipse-liferay-ide-152-setting-up.html .

1) Go to File → New → Liferay Project

2) Next, go through the following steps to setup your new portlet:
  1. Fill in the Project and Display names with my-greeting-portlet and My Greeting, respectively
  2. Select the Liferay Plugins SDK and Portal Runtime that you’ve configured
  3. Select Portlet as your Plugin type
  4. Click Finish
02-portlet-development-1.png
Creating the My Greeting portlet

Deploying the Portlet

Liferay provides a mechanism called auto-deploy that makes deploying portlets (and any other plugin types) a breeze. All you need to do is drop the plugin’s WAR file into a directory and the portal will take care of making any necessary changes specific to Liferay and then deploy the plugin to the application server.

To deploy in Eclipse - Simply drag your portlet project onto your server. Upon deploying your plugin, your server will output messages indicating that your plugin was read, registered and is now available for use.
Reading plugin package for my-greeting-portlet Registering portlets for my-greeting-portlet 1 portlet for my-greeting-portlet is available for use 
If at any time you need to redeploy your portlet while in Developer Studio, right click your portlet located underneath your server and select Redeploy.
02-portlet-development-2.png
Redeployment of the My Greeting portlet


You should get a BUILD SUCCESSFUL message, which means that your portlet is now being deployed. If you switch to the terminal window running Liferay, and wait for a few seconds, you should see the message 1 portlet for my-greeting-portlet is available for use. If not, something is wrong and you should double-check your configuration.
Go to your web browser and login to the portal as explained earlier. Then, hover over Add at the top of the page, and click on More. Select the Sample category, and then click Add next to My Greeting. Your portlet should appear in the page below.
portlets-add-my-greeting-portlet.png
Adding the My Greeting portlet
 

No comments:

Post a Comment