Portlets provide a way to aggregate content from multiple content sources. While that task is a common requirement for many Web applications, portlets are not always the best choice for content aggregation. In this interview with Artima, Brian Chan, chief architect and founder of open-source portlet framework maker Liferay helps decide when using a portlet framework makes sense.
Chan mentions, for instance, that the use-cases for portlets have evolved, and that many original shortcomings of portlets, such as the use of undecipherable URLs, have been addressed by various portlet frameworks:
A lot of times, people ask, Why don't I just use a bunch of iframes, or a simple Struts Tiles app, and just have a bunch of boxes? Why should I go through the pain of using a framework that some people would say is slow or has weird URLs?
There are some real benefits to using portlets. One of them is a segregated class loader and segregated request attributes, and segregated scoping.
Imagine this: You have a team in India building a specific component, which is a specific portlet, and it's using Struts 1.1. Another team in China is building a different application, using Struts 1.2. You could never combine those in a traditional Web application. Using a portal, those are completely segregated, and you're guaranteed that the different teams won't clobber each other. Additional things, like window states, portlet modes, preferences, are also benefits of portals.
Some of the traditional failures of portals with ugly URLs ... that's something that LifeRay has, in particular, solved. We try to make [URL]s REST-like so that they make sense.
![]() |
Brian Chan, chief architect of Liferay, talks about use-cases for portlets. |
When do you think it is appropriate to use a portlet framework, and when would you rather build a content aggregation application yourself?
Post your opinion in the discussion forum.Have an opinion? Be the first to post a comment about this article.
Frank Sommers is Editor-in-Chief of Artima Developer. He also serves as chief editor of the IEEE Technical Committee on Scalable Computing's newsletter, and is an elected member of the Jini Community's Technical Advisory Committee. Prior to joining Artima, Frank wrote the Jiniology and Web services columns for JavaWorld.
Bill Venners is president of Artima, Inc. He is author of the book, Inside the Java Virtual Machine, a programmer-oriented survey of the Java platform's architecture and internals. His popular columns in JavaWorld magazine covered Java internals, object-oriented design, and Jini. Bill has been active in the Jini Community since its inception. He led the Jini Community's ServiceUI project, whose ServiceUI API became the de facto standard way to associate user interfaces to Jini services. Bill also serves as an elected member of the Jini Community's initial Technical Oversight Committee (TOC), and in this role helped to define the governance process for the community.
Artima provides consulting and training services to help you make the most of Scala, reactive
and functional programming, enterprise systems, big data, and testing.