It’s common to create portlets that extend
GenericPortlet provides a default
implementation. Upgrading a
GenericPortlet is straightforward and takes only
Adapt the portlet to Liferay DXP 7.0’s API using the Upgrade Planner.
Resolve its dependencies.
This tutorial demonstrates upgrading a Liferay Plugins SDK 6.2 sample portlet
called Sample DAO (project
The sample portlet has the following characteristics:
- View layer implemented by JSPs
- Persists models using the Data Access Object (DAO) design pattern
- Specifies database connection information in a properties file
- Manages dependencies via Ant/Ivy
- Developed in a Liferay Plugins SDK 6.2
The portlet uses a traditional Plugins SDK portlet project folder structure.
GenericPortlet portlets involves these steps:
Since the sample portlet’s dependencies haven’t changed, upgrading it involves only adapting the code to Liferay DXP 7.0’s API. The Upgrade Planner facilitates updating the code and resolving compilation issues quickly.
You deploy a
GenericPortlet to Liferay DXP 7.0 in the same way you deploy to
Portal 6.x. When the plugin WAR file lands in the
folder, Liferay DXP’s Plugin Compatibility Layer converts the WAR to a Web
Application Bundle (WAB) and installs the portlet as a WAB to Liferay DXP’s OSGi
On deploying an upgraded portlet, the server prints messages that indicate the following portlet status:
- WAR processing
- WAB startup
- Availability to users
Deploying the sample portlet produces messages like these:
20:57:02,571 INFO ... [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:252] Processing sample-dao-portlet-184.108.40.206.war ... 20:57:12,639 INFO [fileinstall-C:/portals/liferay-dxp-digital-enterprise-7.0-sp1/osgi/war][BundleStartStopLogger:35] STARTED sample-dao-portlet_220.127.116.11  ... 20:57:13,480 INFO [fileinstall-C:/portals/liferay-dxp-digital-enterprise-7.0-sp1/osgi/war][PortletHotDeployListener:313] 1 portlet for sample-dao-portlet is available for use
The portlet is now available on Liferay DXP.
You’ve learned how to upgrade and deploy a portlet that extends
GenericPortlet. You adapt the code, resolve dependencies, and deploy the
portlet as you always have. It’s just that easy!