This frame work has many features and it uses Liferay APIs to rapid portlet development and easy to use. It is very light weight frame work and it come up with liferay Plugins SDK.

Liferay MVC portlet is default liferay portlet development frame work and it is inbuilt in Liferay Plugins SDK. We need not to do any additional configuration or need not to add any additional jar files when we develop portlet using Liferay MVC. It’s also follows all JSR portlet standards and it inherited the Generic Portlet features.

Liferay IDE has support to create Liferay MVC portlet and deploy into servers.

Generally when we use Generic Portlet developer need to handle more code but when we use Liferay MVC it will cut down development effort when we think in prospective of code, it have very good mechanism to handle portlet lifecycle.

MVC portlet hierarchy When we moving to up to down it meaning we are getting many features in the child class i.e. MVC Portlet have many features.

We already have experience with Generic Portlet and we already well aware of Portlet Life cycle and its JSR 168&286 features.

Go through following articles for more understand about portlet development and life cycle.

JSR168&286 Standards Portlet Development

GenericPortlet Development

In the generic portlet development portlet class need to override doView(--) ,processAction(--)  for every use of portlet action or render.

But when we use Liferay MVC Portlet we need not override any of the above methods because those methods already implemented and they have designed good mechanism to render views and perform portlet action without overdoing any of the method.

Here we will handle page navigation or render the views by simply  using some request parameters in URL and similarly we will specify portlet class action method name as request parameter in portlet Action URL to perform action.

In the portlet Action Phase we will simply specify the portlet class method name in URL parameter so that it will perform action. So here we need not override processAction(--)  method

Navigate from one jsp page to another jsp page

Perform Portlet Action Phase

When we perform multiple actions then we simple create multiple Action URLs and use URL name attribute to specify the action method name so that it will perform action phase.

It is very convenient to developer to avoid many if else blocks in processAction(--) method and we need not override process action method.

Access Action URL request Parameters in Render Phase or JSP page.

We already know when we specify URL parameters in Action URL those are not available in jsp page or render phase.

We have to use Set Render Parameters method in action phase or we have to use Copy Render Parameters method in action method or action phase.

We have some request parameter in Portlet Action URL and after perform action phase through portlet class action method then we need to access Action URL parameters in Render Phase or JSP page.

JSP Navigation or Render different Views from Action Phase

In general portlet development after performing action phase we need to navigate result page.
To Perform Action URL we already know URL parameters are not available in render phase that is what we cannot set jspPage/mvcPath in Action URL parameter.

We need to set this parameter value in Portlet class action method so that after perform action it will render specified jsp page that we mention as mvcPath

Access Form input data or URL request parameters in Portlet Class Action Method

In portlet development we will send data from client to server using form input elements or as URL request parameters.

In the server side or portlet class action method we will use get Parameter or we have liferay Util class called Param Util to access the URL or form input data.

When we use Param Util we have flexibility to access desired data type we need not to do explicit type casting.

If we use get Parameter then we needs to do type casting the value to get desired data type because request parameters always is string.

Example methods in Param Util class

Required Name Space Parameter Behavior in Liferay

Liferay 6.2 we have to append  portlet Name space for every name of input element i.e. form input elements or request parameters names otherwise portlet action class ignore  the parameters which does not have portlet name space to names.

Send the Data from Portlet Class Action method to JSP pages.

Generally we need requirement that need to send some data from portlet class action method to jsp pages.

After perform some business logic we need to send some data from portlet class action method to jsp pages

We have three ways to send data to JSP Pages.

Set  Arrtibute and Get Attribute on portlet  request object

We will use set Attribute to set some object or value in portlet class Action method and we will use get Attribute method in jsp page to get value in jsp.

In the above portlet class action method we are passing employee data from map object, we will set map object in request.

Get the map object in JSP  page

Set Render parameter method on Portlet Response Object

In the portlet class action method

Copy Render Parameters method

Liferay Tag Libraries and its Usage in JSP page.

Liferay have rich built in tag libraries and they have many components in set of library.
[null, {"document_url": "http://www.liferaysavvy.com/2014/04/liferay-mvc-portlet-development.html", "unformatted_src": "http://3.bp.blogspot.com/-9l92KSeZ12s/U19n9cP0FvI/AAAAAAAAGao/StSi1y9gdcg/s1600/1.PNG", "src": "http://3.bp.blogspot.com/-9l92KSeZ12s/U19n9cP0FvI/AAAAAAAAGao/StSi1y9gdcg/s1600/1.PNG", "rendered_width": 400, "rendered_height": 273}, null, {"document_url": "http://www.liferaysavvy.com/2014/04/liferay-mvc-portlet-development.html", "unformatted_src": "http://4.bp.blogspot.com/-L8TQ9VdPp2Y/U19pJrpgBvI/AAAAAAAAGa0/RXRgwTsAwBw/s1600/2.PNG", "src": "http://4.bp.blogspot.com/-L8TQ9VdPp2Y/U19pJrpgBvI/AAAAAAAAGa0/RXRgwTsAwBw/s1600/2.PNG", "rendered_width": 320, "rendered_height": 400}, null, {"document_url": "http://www.liferaysavvy.com/2014/04/liferay-mvc-portlet-development.html", "unformatted_src": "http://3.bp.blogspot.com/-NTffpoCFpzY/U19pVabULOI/AAAAAAAAGa8/pkeLCJtc_x0/s1600/3.PNG", "src": "http://3.bp.blogspot.com/-NTffpoCFpzY/U19pVabULOI/AAAAAAAAGa8/pkeLCJtc_x0/s1600/3.PNG", "rendered_width": 400, "rendered_height": 125}, null, {"document_url": "http://www.liferaysavvy.com/2014/04/liferay-mvc-portlet-development.html", "unformatted_src": "http://2.bp.blogspot.com/-r6nfZNzTcRQ/U19paW-iXHI/AAAAAAAAGbE/jNTc3yE6pW0/s1600/4.PNG", "src": "http://2.bp.blogspot.com/-r6nfZNzTcRQ/U19paW-iXHI/AAAAAAAAGbE/jNTc3yE6pW0/s1600/4.PNG", "rendered_width": 400, "rendered_height": 166}, null, {"document_url": "http://www.liferaysavvy.com/2014/04/liferay-mvc-portlet-development.html", "unformatted_src": "http://4.bp.blogspot.com/-42SCPyDT3qA/U19ped8A6_I/AAAAAAAAGbM/18kqdUjwBec/s1600/5.PNG", "src": "http://4.bp.blogspot.com/-42SCPyDT3qA/U19ped8A6_I/AAAAAAAAGbM/18kqdUjwBec/s1600/5.PNG", "rendered_width": 400, "rendered_height": 145}, null, null, null, null, null, null, {"document_url": "http://www.liferaysavvy.com/2014/04/liferay-mvc-portlet-development.html", "unformatted_src": "//lh4.googleusercontent.com/-q06zTooeh10/AAAAAAAAAAI/AAAAAAAAN04/V7gdj1l-cUg/s80-c/photo.jpg", "src": "http://lh4.googleusercontent.com/-q06zTooeh10/AAAAAAAAAAI/AAAAAAAAN04/V7gdj1l-cUg/s80-c/photo.jpg", "formatted_filename": "photo", "alt_text": "My Photo", "rendered_width": 80, "rendered_height": 80}, null, null, null, null, null, null, null, null, null, null, null, null, null]