Creating Liferay Portlet using Liferay Developer Studio

A portlet is a component of a portal application. It is a part of a Liferay portal application. Several portlets combined make a portal application.

In this article, we will learn about how to create a simple portlet using Liferay Developer Studio.

The following are the steps to create a Liferay portlet.

Version Details: Liferay version 6.2 with Apache Tomcat 7 server.

Creating the Liferay Portlet

  • Open LDS and Navigate to File > New > Liferay Plugin Project, as shown below:
LiferayPortlet1
  • Add the Project Name in the field, set up the SDK location and run time environment.
  • Please note that we have selected the checkbox Include sample code below. This will add a sample JSP page and other required portlet configurations.
  • We can add new portlets to the plugin project from New > Liferay Portlet option.
  • A Liferay plugin project can contain multiple portlets.
LiferayPortlet2
  • We can configure Plugin SDK by adding the available plugin path from plugin SDK configuration window as shown below and click on the OK button.
LiferayPortlet3
  • Following image shows how to create a new the Liferay server run time environment set up.
LiferayPortlet4.png
  • Select the version of the server and click on the Next button. Select the tomcat path as shown below and click finish button.
LiferayPortlet5
  • Click on next button on the configuration window and select Liferay MVC radio button and click on the finish as shown below.
LiferayPortlet6.png
  • The Portlet is now created. Following image shows the folder structure of the created project.
LiferayPortlet7
  • Deploy the portlet by Right Click on portlet > Liferay > SDK > direct-deploy/deploy as shown below:
LiferayPortlet8.png
  • Add the portlet from the Add button of Applications option as shown below.
LiferayPortlet9.png

Conclusion

In this article, we learned how to create a custom Liferay portlet using the Liferay Developer Studio(LDS) IDE.

We also learned how to add the created portlet into our Liferay portal application.

You may also be interested in