Saturday, October 24, 2009

INTRODUCTION: ICEfaces JSF Portlets in Liferay using NetBeans

In this Blog, I will post concise instructions to setup and develop JSF based portlets with ICEfaces and Liferay using NetBeans.

The steps outlined in this Blog should be followed in sequence. I will try to make the steps very straightforward, explicit, and easy to follow. To help get you up-and-running as quickly as possible, I will not offer too many explanations or wordy comments for each of the steps.

Background

Initially, I spent a great deal of time trying to install the Liferay portlet development environment. I tried the Liferay SDK and the EXT environment. I found that the Liferay documentation was outdated in many cases, the steps were not explicitly clear, and the organization of the documentation made it difficult to find the right instructions for someone who simply wanted to get started developing portlets for Liferay.

The most surprising thing I discovered, when I had finally built and deployed my first ICEfaces portelt into Liferay, was that I didn't even need the Liferay EXT environment or the Liferay SDK!

IDE

After much trial and error with Eclipse, I found that NetBeans has a very straightforward and effortless portal server integration. Portal servers can be started and stopped within NetBeans. Also, you can do all of your work in the NetBeans IDE and don't have to execute command line scripts to code Liferay portelts. In contrast, I found that Eclipse + Liferay integration required me to pull in build scripts and dependencies form the EXT environment, and I never could get past missing library references within the IDE. As a result of this experience, my initial posts will focus on using NetBeans. (At some point in the future I will give Eclipse another try, since it seems others have had success with this environment, and I will post step-by-step instructions for Eclipse at that time).

JSF

In addition to using Liferay, I wanted to use JSF to create portlets, because JSF provides a rich tag library for building user interfaces and has a very nice MVC (Model View Controller) paradigm, which cleanly separates the presentation layer (JSFs) from the business layer (Managed Beans).

Since SUN has abandoned Woodstock, they have recommended migrating to ICEfaces. Yet again, I was faced with the lack of clear documentation on creating JSF (or ICEfaces) based portlets for Liferay. ICEfaces facilitates developing portlets through a NetBeans / Liferay plugin, and the ICEfaces framework does not rquire a JSF/Portlet bridge, like other JSF/portlet implentations.

Platform

The software versions used in developing these instructions are as follows. I expect future versions of the software to be backward compatible, so these instructions should be usable for some time. I will attempt to update these instructions as newer versions of the software are released.
  • SUN JDK 1.6.0_16
  • Liferay 5.2.3 for Tomcat 6.0.18
  • Liferay 5.2.3 for Glassfish 3 (optional)
  • Tomcat 6.0.20 (optional)
  • NetBeans 6.7.1
  • NetBeans PortalPack 3.0.2
  • ICEfaces 1.8.2

The development hardware I am using is a 64 Bit Intel CPU with 4GB, running Kubuntu 9.04 x64 Linux (http://www.kubuntu.org/). I'm sure these instructions will work for other hardware and Linux distributions, as well. For Windows installations, the sequence of steps and downloads needed are probably accurate, but you will have to use alternatives for some of the Linux commands I have listed. (For example, in Windows, use Notepad to edit files, instead of the Linux sed "search and replace" command; use WinZip to extract files; and ignore the chown and chmod commands that set Linux file permissions and ownership).

Conventions

Finally, to save save time and help list required steps concisely, I have adopted the following conventions in my posts...

$...
  • Execute something on the command-line.
  • For example, $ ls
  • Of course, you should not copy the command prompt "$" when cutting/pasting these commands
| (pipe)...
  • Separates left mouse button click actions.Whenever a right mouse click is necessary, it is explicitly stated.
  • For example, K | System Settings | Advanced | Login Manager | Cancel means click on the K menu, then select System Settings, then click on the Advanced tab, then click on the Login Manager icon, then click on the Cancel button.
DOWNLOAD:...
  • The file you should download
FROM URL:...
  • Where you should download the file from

12 comments:

  1. Great job. Thanks for this. I posted a link in our own forums:

    http://www.icefaces.org/JForum/posts/list/15076.page

    ReplyDelete
  2. Deryk, thank you. I hope this information is helpful to the community.

    ReplyDelete
  3. if anyone bothers: i've developed a maven archetype for creating hybrid web-applications with icefaces. besides the fact that its also runnable in a "normal" tomcat, you can also deploy it as a portlet in liferay. i think this will save a lot of frustration integrating icefaces into liferay ;)

    http://fabianmaass.de/?p=51

    by the way: i think you missed out on the "liferay-plugin-package.properties". if you don't disable the liferay speedfilters, there is no chance of running ajax applications in liferay after you hot-deploy your war file to the liferay/deploy folder. i don't know if those are applied aswell when you add your war over the admin console, but i assume so.

    ReplyDelete
  4. Fabian,

    Thanks! I'm going to check out your maven archtype.

    Also, can you clarify what parameter needs to be added to the liferay-plugin-package.properties file to disable the speed filters?

    ReplyDelete
  5. hey,

    sure thing:

    in \WEB-INF\liferay-plugin-package.properties

    speed-filters-enabled=false


    btw thanks for your work and the nice series. i was looking in the forums and i've seen a lot of requests for a step-by-step guide like this.. :)

    ReplyDelete
  6. This blog is exactly what I need. Thanks a bunch... Awesome. I hope you keep it going. - Ray

    ReplyDelete
  7. Ray,

    Thanks. I will be be adding the JSF navigation portion within the next few days.

    ReplyDelete
  8. BUT !!!!!!!!!!!, what about facelets , with this, you can not use includes , only with facelets ..

    ReplyDelete
  9. Thank you! I was looking for a tutorial just like this one!

    ReplyDelete
  10. when i try to start glassfish via netbeans

    there comes this message:

    'java' is not recognized as an internal or external command,
    operable program or batch file.

    have the jdk in the path directory. when i manually open a cmd window the "java" command works.

    any idea?

    ReplyDelete
  11. Please let me know if I should use "JSF 1.2" instead of "IceFace", what should I do in this example?

    ReplyDelete