Introducing Portlet Generator 1.0

I’ve just added the portlet generator utility to this site.  This utility replaces the “create.bat” and “create.sh” scripts that come with Liferay’s PluginSDK.  It offers a GUI entry panel as well as the options to generate 4 different types of sample portlets: Struts, Spring, Struts2, and JSP.  I plan to add more functionality to this later and expand its offering if the need arises.

The Swing interface is very simple: just fill in the portlet name (or portlet id), the display name (what will be shown in the title) and select the type of portlet.  Then click the Generate button to make it all happen.  A couple of things to note:

1) Follow the instructions on the download page.
2)Be aware that the Struts and Struts2 samples come pre-packaged with the Liferay tomcat loader already set in the META-INF folder.  You’ll need to either change or delete according to your application server needs.

Tags:
Posted in Annoucements by Jeff Robinson. 7 Comments

10 Reasons to adopt Portlet Development

Many times I am asked why I’m such an advocate of portlet development over standard servlet development. “What are the advantages” the naysayers wonderk?  Well, for those of you still considering portlet development, let me give you ten reasons why you should make the switch.

  1. Portlets development is the componentization of your web interface.  Just like desktop applications use windows to represent separate processes, portlets do the same for web-based applications.
  2. Portlets are reusable.  If done correctly, portlets can be developed to be used over and over again on multiple pages with little or no customization.
  3. Portlets frees you from being tied to one framework over another.  You could have five portlets using five different frameworks on the same page and still have robust web application.  This means you can harness the strengths of your resources rather than forcing them to all learn one development stack over another.
  4. Portlets development is a relative easy paradigm shift.  That’s because its creators modeled it after the standard Servlet API.  (Check out my article on the topic for more info).
  5. Deployment is a step easier if you use portlets.  Since portlets are only sub-components of the entire web application, you can easily install/uninstall portlets without affecting the overall webapp.
  6. Portlet applications are easier to maintain. For the same as reason as #5, you can upgrade a portlet without having to re-install or re-work your entire web inteface.
  7. Portlets are interoperable.  With JSR-286, inter-portlet communication is a built-in feature.
  8. Portlets are supported by all the major frameworks.  Yes, this may seem like a repeat of  #3, but really it isn’t. The point here is that if you’re using Spring, Struts, or  JSF you can continue using those frameworks without having to learn a totally different one.
  9. Portlets are easily customizable. In fact, this was one of the hallmarks of JSR-168: portlets can be customized by an authorized user while its active by just switching to the Edit mode and making the changes.
  10. Portlets are skinnable.  In these times when having themes for skinnability, portlets have always been way out front in featuring this ability.

Well, I hope these 10 reasons help in convincing any skeptics that portlet development really is the only direction that future web application development can trend.   Please feel free to add any other reasons you can think of in the comments section.

Posted in General by Jeff Robinson. 1 Comment

Using jQuery with Liferay, Part 2

Four more core effects are Show, Toggle, Fade In, and Animate.   This week’s portlet and the screencast below gives a demonstration of these four effects in a Liferay Portlet. As I should have mentioned last time, the code within the portlet to do one of these effects is very small. Here’s the code for the toggle:

jQuery('#link2').click(function() { jQuery('# block2').toggle();});

Of course, you have to setup a “div” with a unique “id=”. For portlets, we simply prepend the tag which makes the id unique across the portal. Take a look at the source code in the portlet’s view.jsp file for more information. I tried to keep the jQuery code clean and simple so beginners shouldn’t have to cringe too much ;-).

Tags: , ,
Posted in Tutorials by Jeff Robinson. 2 Comments