Custom portlet into control panel in Liferay 7.2


1. Create MVC portlet:

  1. Go to Liferay workspace project modules new.
  2. Select other Liferay Liferay Module Project and click on "Next".
  3. Enter the project name.
  4. Select "Project Template Name" as "mvc-portlet" and click on "Next".
  5. Enter a Package name and click on "Finish". The necessary file structure for the MVC module will get created as below.


Replace the property with this code in your portlet class

		package com.themeray.student.portlet;
		import com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet;
		import com.themeray.student.constants.StudentPortletKeys;

		import javax.portlet.Portlet;

		import org.osgi.service.component.annotations.Component;
			immediate = true,
			property = {
				"javax.portlet.display-name=Student Portlet",
				"" + StudentPortletKeys.STUDENT,
			service = Portlet.class
		public class StudentPortlet extends MVCPortlet {



2. Implement your constants class:

Add the below code in your constants class.

		package com.themeray.student.constants;
		public class StudentPortletKeys {

			public static final String STUDENT =



3. Add Dependency:

Add below line in "build.gradle" file

compileOnly group: "com.liferay",name:"com.liferay.application.list.api"


4. Create your panel app component class:

This class must extend the BasePanelApp Class and declare it as a service using service = PanelApp.class.

Add a new class named StudentPanelApp

		package com.themeray.student.portlet;

		import com.liferay.application.list.BasePanelApp;
		import com.liferay.application.list.PanelApp;
		import com.liferay.application.list.constants.PanelCategoryKeys;
		import com.liferay.portal.kernel.model.Portlet;
		import com.themeray.student.constants.StudentPortletKeys;
		import org.osgi.service.component.annotations.Component;
		import org.osgi.service.component.annotations.Reference;

				immediate = true,
				property = {
					"panel.category.key=" + PanelCategoryKeys.CONTROL_PANEL_USERS
				service = PanelApp.class)
		public class StudentPanelApp extends BasePanelApp {
			public String getPortletId() {
				return StudentPortletKeys.STUDENT;
			@Reference(target = "(" + StudentPortletKeys.STUDENT + ")", unbind = "-")
			public void setPortlet(Portlet portlet) {


Let's understand the following:

"panel.category.key" defines the category which is "control_panel.users" in our case. So our Student portlet will be added under "Users" section in the control panel.

"" defines the portlet position in the portlet list under "Users" section in the control panel.

5. Deploy your module: