Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suggestions on Portlet Development Approach on Liferay

We are in the phase of evaluating some of the frameworks for portlet development. As of now I know of below 3 options. I would like to know your experiences with them and others

  1. Struts 2
  2. Spring Portlet MVC
  3. Liferay 6.x MVC Framework

Please try to share Pros/Cons in following areas along with what you think is important

  • Speed of development
  • Maintenance
  • Ease of development with Geo Distributed teams

Please suggest any other frameworks which can be used as alternative with some pros/cons

like image 661
Kzvi Avatar asked Feb 24 '11 19:02

Kzvi


People also ask

What are the advantages of Liferay portal?

With Liferay Development Services, these issues do not arise. With multiple built-in plug-ins, and portlets. Functions can be easily integrated without affecting any of the existing data on the platform. Additionally, any extra features that may need to be added to increase the value, can be done without any hindrance.

What is portlet in Liferay?

Web apps in Liferay DXP are called portlets. Like many web apps, portlets process requests and generate responses. In the response, the portlet returns content (e.g. HTML, XHTML) for display in browsers.

What is the life cycle of a portlet?

portlet have similar lifecycle as that of a servlet, portlet needs a portlet container similar to a servlet, we know that servlet have lifecycle of init(), service() and destroy() similarly liferay's lifecycle have the following stages.


3 Answers

From my point of view, using MVCPortlet and JSPs without Spring-mvc or Struts is suitable enough only for a simple portlet. I would definitely try at least a sample portlet to see how it works if developers haven't done portlets.

The only advantage of using Struts is that the Portal itself is heavily using it because spring-portlet-mvc is relatively new. So that you can learn a lot from variety of examples. Otherwise the technology afaik is dying (regarding portlet development) and if you haven't been working with Struts, the better option for you would be go for spring-portlet. I've been using spring-portlet for more than a year, and I must say that I was amazed how well integrated it is into portlet container and what features are implemented there. You can do practically everything as with spring-mvc (servlet spec), except for some minor support that I found redundant anyway.

Speed of development an experience developer that knows spring-mvc can create a robust application with only a few spring controllers.

Maintenance The amount of source code is significantly lesser with spring then struts. Spring-portlet has implemented 268 JSR, so that it saves couple of workarounds.

Ease of development with Geo Distributed teams I sense you are going for something bigger, so that ask developers about their experience with Spring and Struts and make your choice. Anyway, Liferay is a pretty robust portal solution and to "learn" it and find a way to use it properly is more important issue than how to develop portlets.

Also be interested in developers knowledge of Javascript. If they don't know JS much or you don't have front-end developers, I would probably give a shot to Vaadin or GWT portlets. However Liferay has a very good client-side support and you'll see that a lot of things can be done on client-side in Liferay. JSP tag libraries provides a significant amount of dynamic behavior and Alloy JS framework that is built on top of YUI provides you with a nice environment and it is not hard to use.

EDIT: The comparison of Struts vs. Spring is regarding portlet specification, where (my opinion) struts support is an old Volkswagen and spring is Bentley continental gt :-)

ALSO: The key tool for Liferay portlet development is so called ServiceBuilder, which is a code generator, that generates a significant part of your persistence layer, remote service layer based on domain model and metadata. If you choose to use it, your portlet is automatically Spring based. And I'd recommend to use it, because once you try it, you won't let it go. For instance, to create Ajax calls from client-side to remote services is a question of 2 minutes to set it up and be able to call them and even get the return value. Hibernate setup is fully optimized and ready to use after you run servicebuilder. And much, much more.

like image 139
lisak Avatar answered Nov 12 '22 18:11

lisak


It's Really depend on your requirements, since liferay MVCPortlet are just simple sub-classes of the javax.portlet.GenericPortlet, i dont think it's a fair comparison between web framework such as Strut 2 or Spring MVC.

I suggest using Spring MVC or Struts 2 for 168 & 268 JSR portlet if you want cross portlet-container portability or if you have more complex presentation requirements, you should find a list of the pro and cons of the two framework everywhere .

If you requirement are very simple then go with liferay MVCPortlet or even the JSPPortlet.

like image 20
Chuck Mah Avatar answered Nov 12 '22 18:11

Chuck Mah


I have used 2) and 3) but not 1) - I'm not a fan of Struts.

Spring MVC gives you the power of Spring and plugs seamlessly into a Spring back-end as well as allowing the ability to wire to the Liferay Spring services. Provided you use MVC correctly and separate Controller concerns into separate Action classes then this is an extremely scalable and flexible choice and works well when coupled with Liferay.

Liferay's MVCPortlet provides much less in terms of flexibility but when used properly it is still highly scalable and a very useful choice. It also ties in to the Liferay IDE/Liferay Development Studio which provides benefits during development. If you have access to the Liferay Developer training then there is extensive coverage on Day 2.

Overall Spring has the greater benefits but also comes with the larger learning curve and greater risk of doing things incorrectly and hits you harder when done badly. Liferay's MVCPortlets done badly end up looking like vanilla portlets and as such is the lesser evil. Personally I use MVCPortlets for small tasks and Spring MVC for the larger ones.

In both cases 'doing it well' involves correct use of the framwork and annotations.

Liferay also supports Vaardin and have released the new Mail Portlet using it. I haven't used Vaardin but certainly plan on it and have heard good things so far.

like image 42
David O'Meara Avatar answered Nov 12 '22 19:11

David O'Meara