Getting started with Liferay portlet with Java

    Explained the inter communication between jsps and java class

Note: Refer comments for attribute,object,tags explanations.
Lets start with creating a simple portlet using LifeRay.

Portlet is a Java Web-Application that can be embedded into the pages that we have created using Liferay Web Admin. A Liferay page is collection of well arranged portlets.

portal LF

1. Setup LifeRay Eclipse Development evn first.Follow Getting started with Liferay portlet with Java

Below Project structure will be created after finishing with Setting Dev env.

2.Add a new Portlet through Eclipse > New > LifeRay Portlet Wizard.


Give the class name and extend it from MVCPortlet class and finish.

3. Finishing with the above will register the new portlet entries in portel.xml,liferay-portlet.xml and liferay-display.xml as well as it will create a view.jsp {only view mode is selected while adding new portlet} and a class named

4. Now lets add some code in jsp and java to explain the communication between each other.

Already we have created a portlet class. Now lets make some inputs in portlet view jsp.


View jsp will call the getAge() method of MyPortlet1 class as name attribute of actionURL is linked to method name defination in servlet.

Lets put some code in MyPortlet1 so as to explain how the request object is captured ,used and render response is dispatched back to the view end.

Above sample code will get the input value from portlet view and it will dispatch the response after processing it.


Deploy the portlet or redeploy is already added.

Go to the add portlet after signing in and drag and drop the MyPortlet1 portlet.


GettingStartedWithPortletJavaJsp Download

Leave a Reply

Your email address will not be published. Required fields are marked *

Blue Captcha Image