Thursday, December 8, 2011

Best Web Framework for Liferay Portlet Development

Over the past months I've tried several web frameworks for portlet development on the liferay community portal.

The options I've tried are:


  • The framework liferay provides. (MVC Portlet, Alloy UI)
  • Spring Portlet MVC
  • Vaadin
  • Java Server Faces (Portletfaces and Primefaces components)
  • Java Server Faces (Portletfaces and IceFaces components)
  • Apache Wicket.
In my opinion, I would rate these frameworks in the following way:
  1. JSF Primefaces
  2. Spring Portlet MVC
  3. Vaadin
  4. Liferay Framework
  5. JSF IceFaces
  6. Wicket.
This is the discussion of each:

JSF Primefaces

This is the one I found best, easy to configure, most of the components working out of the box, and easy spring integration. The con is, if you're used to JSF 2 and greater you'd find some missing features which are kind of important like view scoped managed beans and you loose the ability to send parameters over EL (this is because of the spring integration). But in general terms this framework fits great for general portlet development.

Spring Portlet MVC

This framework really gets along with the portal and is the ideal thing if you like to code tons of javascript and have fine grained control over everything. The con is the increased development time and if you have a project with lots of portlets then you'll have a lot of xml files.

Vaadin

Vaadin does a great job also for portlet development most of the components work out of the box, but it has some annoyances: 
  • Every time you change something you need to re deploy your portlet.
  • You need to have the same vaadin library you're developing deployed on your portal which may cause problems with older vaadin portlets.
  • Compile-time weaving for spring integration.
  • Some features mising.
Liferay Framework

This framework works really well on liferay, but is really a developer nightmare, not well documented, lots of javascript and java code, difficult to integrate with your own spring context. In general terms, this is only well-suited for really simple portlets with no ajax support.

JSF IceFaces

This is supposed to be the best option for liferay JSF portlet development, or at least that's what the creators say, nevertheless I couldn't really make it work after several hours of configuration and web browsing, but as it is a JSF framework, the basic jsf features work well, and I think with the proper documentation this could get really good.

Wicket
Even though I love wicket and was the first option I tried, I was disappointed that it barely worked. No wicket magic for ajax support and also wicket dropped support for portlets on 1.5 so really, is not a good option for liferay.

Well, that's it with the frameworks, I hope this short review can help you to find the best framework for developing liferay portlets.

7 comments:

  1. I think it wold be nice if you add ZK to the list: http://www.zkoss.org/
    Liferay example:
    http://books.zkoss.org/wiki/ZK_Installation_Guide/Setting_up_Servers/Liferay

    ReplyDelete
  2. What exactly did not work for you, when using Wicket with Liferay? We use Liferay 6.0.5 with Wicket 1.5.3 and we have build over 100 Ajax based portlets and everything works just fine. Did you try the last bundle from https://issues.apache.org/jira/browse/WICKET-4019 (wicket-portlet-1.5.2.4.zip)?

    ReplyDelete
    Replies
    1. At the time I did the test, only wicket 1.4 supported portlets, and it just didn't work with ajax, I shall give a try to wicket 1.5.3.

      Delete
  3. Hi Juan,
    very goog post!
    But I wonder why you pointed out @ViewScope as a con in Primefaces and Liferay. I guess you can use @ViewScope if you use JSF managed beans rather than Spring beans, can't you?
    Anyway, if you need that, you can read this article by Cagatay Civici
    http://cagataycivici.wordpress.com/2010/02/17/port-jsf-2-0s-viewscope-to-spring-3-0/
    Kind regards
    David

    ReplyDelete
    Replies
    1. Hi David!

      Really I think that the view scope doesn't make that sense on portlets because the same "view" can be used at the same page by the same user (for example a page that has the same portlet more than once) so it would be kind of a mess to manage those managed beans, also you have the case when the same portlet is on different pages and you cant tell wether is the same view or not (for faces is still the path of the xhtml file). Nevertheless I managed to implement a "page" scope by creating a new spring scope to make managed beans scoped while the user is at the same page.

      Delete
  4. Wicket works just fine foe me, in Liferay v.6.2, and v.7 M3.

    You need to add JQuery and Wicket-specific JavaScripts (taken directly from WIcket sources) to your theme; Wicket cannot (should not) define anything in a "head" section of HTML.

    As a sample, editable (AJAXable) labels work fine for me after that.

    The only problem is if I want to use Bootstrap 3 -based Look-and-Feel, and if I want to use Liferay features such as Asset framework. Then, I need to use JSP tag libraries (or to reinvent my own Wicket classes for that). Plus, Alloy-UI.

    So that I think Liferay MVC is the best if you want Liferay-provided features... if you don't need those - then use Tomcat; do not use Liferay.

    ReplyDelete