Announcement: PrimeFaces Technology Partnership

Company Blogs October 31, 2012 By Neil Griffin Staff

Liferay has entered into a new technology partnership with PrimeTek Informatics, maker of PrimeFaces.

Customers who have purchased Liferay EE and PrimeFaces PRO now enjoy the benefit of a communication channel between our companies, so that technology issues can be resolved in accordance with corresponding Service Level Agreements (SLAs). In addition, this partnership will ensure that our mutual customers will be able to develop PrimeFaces portlets that can be used in conjunction with the Liferay Faces Alloy component suite.

Please vote for Liferay to serve on the JCP Executive Committee

Company Blogs October 28, 2012 By Neil Griffin Staff

UPDATE: 10/30: Congratulations to the London Java Community and to CloudBees! And thanks to everyone who voted for Liferay.

UPDATE 10/19: Liferay Sr. Software Architect Ray Augé spoke on behalf of Liferay on the "Meet the EC Candidates" call. You can listen to Ray on the MP3 recording from 19m 50s - 23m 35s.

This year Liferay is running for election to serve on the JCP Executive Committee. To my great surprise, Liferay nominated me to be the company's representative. I'm truly honored to be nominated, and if we are elected, we will endeavor to serve the Java community well.
Here is the company description that we submitted for the 2012 Executive Committee Nominations page:
Liferay is an open source software company that is dedicated to the success of the Java platform. As a privately held company, we are free from investor pressures which in turn makes us free to serve the best interests of our 70,000+ member community. We have benefitted greatly from the contributions and feedback of our community members and strongly believe in open/transparent processes. We will strive to contribute this experience if we are elected to serve on the JCP Executive Committee.
We also submitted a brief Position Statement.
If you are a member of the JCP, please cast your vote for Liferay! The voting period is from October 16, 2012 - October 29 2012. We would treasure your vote and would be honored to serve.
Thank you,

Announcement: Liferay Faces in Maven Central

Company Blogs August 31, 2012 By Neil Griffin Staff

The new location for downloading Liferay Faces artifacts (JARs, WARs, etc.) is Maven Central.

As part of the migration of Liferay Faces from to, the Nexus repository is being phased-out. Now that the artifacts are in Maven Central, developer should remove the following repository from project pom.xml files:


Announcement: Liferay Faces 3.1.0-ga1 Released

Company Blogs August 22, 2012 By Neil Griffin Staff

UPDATE: Liferay Faces in Maven Central

On August 22, 2012 Liferay issued a press release announcing the first General Availability (GA) release of Liferay Faces:

  • Liferay Faces 3.1.0-ga1 (JSF 2.0/2.1 + Liferay 6.1.x)
  • Liferay Faces 3.0.0-ga1 (JSF 2.0/2.1 + Liferay 6.0.x)
  • Liferay Faces 2.1.0-ga1 (JSF 1.2 + Liferay 6.1.x)

Project Links

Version Scheme

For information on the Liferay Faces Version Scheme, refer to the Liferay Faces Wiki article.

Release Highlights

We recently announced that Liferay Faces Bridge Certified was certified as JSR 329 Compliant. As a result of this certification, we released a JSF 1.2 compatible version that that developers can use to migrate legacy portlets to Liferay Faces.

Once again, thanks to everyone in the community that reported issues, contributed patches, and participated in the forums!

Notes no longer available in with Mountain Lion

Company Blogs August 15, 2012 By Neil Griffin Staff

If you have used the "New Note" feature in, then you may have noticed that the feature is gone in Mountain Lion. Although I was generally happy with the new Mountain Lion features, this completely disrupted my daily workflow process.

I used the Notes feature to create pseudo "Tasks" as part of a GTD type of workflow. This allowed me to keep tasks and email messages in different folders. Even though the feature is now gone, I found that I am still able to do the same type of thing with draft email messages. For example:

  • Create a new email message
  • Leave the recipient list blank
  • Give it a subject like "Task: Do this and that"
  • Type in some instructions in the email body
  • Save the email message as a Draft
  • Move the message from the Draft folder to some other folder, like "Today"

The only problem was that I wasn't able to edit the messages after I moved them out of drafts. As a workaround, it can still be edited by moving it temporarily back to drafts.


Announcement: Liferay Faces Bridge Certified as JSR 329 Compliant

Company Blogs August 9, 2012 By Neil Griffin Staff

On behalf of Liferay, I'm pleased to announce that as of August 8, 2012, Liferay Faces Bridge (a sub-project of Liferay Faces) has been certified by Oracle as compliant with JSR 329.

JSR 329 is the "Portlet 2.0 Bridge for JavaServer™ Faces 1.2" specification by the JCP. Liferay Faces Bridge 2.1.x has received the official certification (since it is designed for Portlet 2.0 and JSF 1.2). Although Liferay Faces Bridge 3.1.x is designed for Portlet 2.0 and JSF 2.0, it also passes all of the tests in the JSR 329 Technology Compatibility Kit (TCK).

I'd like to extend my personal thanks to Michael Freedman of Oracle -- as the Chairman of the JSR 329 Expert Group, he spent countless hours working on the specification and TCK. He is also a wonderful mentor and friend.

Announcement: Liferay Faces 3.1.0-RC2 Released

Company Blogs July 14, 2012 By Neil Griffin Staff

On behalf of Liferay, I'm pleased to announce the latest release of Liferay Faces:

  • Liferay Faces 3.1.0-RC2 (Compatible with Liferay 6.1.x)
  • Liferay Faces 3.0.0-RC2 (Compatible with Liferay 6.0.x)

Project Links

RC2 Status

The release has been designated RC2 (instead of GA1) because there have been significant changes since the release of RC1, and we wanted to be able to give the community time to kick the tires and provide feedback:

  1. FACES-1307: The new liferay-faces-bridge-api.jar artifact has replaced portlet-bridge-api.jar from Apache MyFaces
  2. FACES-1349: The new liferay-faces-util.jar artifact contains common classes/interfaces (see issue details for repackaging and renaming of classes)
  3. FACES-1286: The Public Render Parameters IPC feature has been modified in order to properly comply with the requirements of the JSR 329 Specification.
  4. FACES-1346: The new test/bridge-tck/bridge-tck-runner project provides run the JSR 329 TCK, and 100% of the TCK tests are passing in Liferay 6.1 and Pluto 2.0.3.

Release Highlights

We've been busy since the release of RC1 (about 45 days ago). The release notes provide summary of over 100 resolved issues, and as shown in the chart below, we've really gotten ahead of the curve.

Thanks to everyone in the community that reported issues, contributed patches, and participated in the forums!

Announcement: Liferay Faces 3.1.0-RC1 Released

Company Blogs June 1, 2012 By Neil Griffin Staff


On behalf of Liferay, I'm pleased to announce the latest release of Liferay Faces:

  • Liferay Faces 3.1.0-RC1 (Compatible with Liferay 6.1.x)
  • Liferay Faces 3.0.0-RC1 (Compatible with Liferay 6.0.x)

Project Links

Release Highlights

This release contains quite a few bug fixes in the bridge, and several improvements in the demo portlets:

  • The jsf2-portlet now demonstrates the ability to upload multiple documents with the HTML5 "multiple" attribute and a fileUploadEvent attribute.
  • The icefaces3-portlet has been enhanced to use ace:dataTable and ace:notificationPanel
  • The icefaces3-compat-portlet has been refactored to use ice:dataTable and ice:panelPopup
  • The primefaces3-portlet has benefited from better integration with p:fileUpload
  • The richfaces4-portlet has been enhanced to use rich:fileUpload, rich:dataTable, and rich:popupPanel

Many of the improvements are related to supporting file upload across the various component suites. Specifically, the fix for FACES-1241 provides enhancements to the bridge's UploadedFile interface and UploadedFileWrapper class. This in turn provided consistency across the demo portlets (each of them now has very similar code for handling file uploads).

Thank You

I wanted to extend my personal thanks to everyone in the community that reported issues and participated in the forums. Your help was invaluable!

JSF PhaseListener instances must be made thread-safe

Company Blogs May 30, 2012 By Neil Griffin Staff

I recently performed a Google Search for "phaselistener not thread safe" and realized that this issue is not widely published, so I'd like to take a moment to discuss it here.

Sooner or later, most JSF developers end up developing a PhaseListener implementation like found in Liferay Faces Bridge. One thing to remember though, is that PhaseListener instances are application-wide Singletons that are referenced by the JSF Lifecycle, which itself is an application-wide Singleton. Since these instances are not created within the PortletRequest thread, they need to be made thread-safe.

First, I recommend reading an external blog post section titled Immutable Objects.

Second, I think easiest way for me to explain what is OK and what is NOT OK is by showing some example code:

	package foo;

import javax.faces.event.PhaseId;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseListener;

public class MyPhaseListener implements PhaseListener {

    // Class-level immutable (final) variables are thread-safe since they are read-only
    // and are initialized at about the same time as the constructor. The Java compiler
    // will also permit you to initialize final variables within the body of the constructor.
    private final String classLevelImmutableVariable1 = "cannot-change-me-1";
    private final String classLevelImmutableVariable2; // initialized in constructor

    // Class-level mutable (non-final) variables are NOT thread-safe. Don't use these
    // without synchronization!
    private String classLevelMutableVariable = "can-change-me-but-dont-do-it!";

    // Static final constants (like loggers) are typically thread-safe.
    private static final Logger logger = LoggerFactory.getLogger(MyPhaseListener.class);

     * PhaseListener constructors execute when Mojarra/MyFaces initializes.
    public MyPhaseListener() {
        // It's OK to initialize final class-level variables here.
        this.classLevelImmutableVariable2 = "cannot-change-me-2";

    public void afterPhase(PhaseEvent phaseEvent) {

        // Accessing method parameters is thread-safe.
        PhaseId phaseId = phaseEvent.getPhaseId();

        // Accessing FacesContext is thread-safe since it is a ThreadLocal singleton.
        FacesContext facesContext = phaseEvent.getFacesContext();

    public void beforePhase(PhaseEvent phaseEvent) {

        // Creating local method variables is thread-safe, since the JVM will create an
        // instance (copy) on the stack for each Thread.
        String mutableLocalMethodVariable = "ok-to-change-me-in-the-scope-of-this-method";

        // Writing to a logger is thread-safe, providing the underlying logger
        // implementation is thread-safe!
        logger.debug("inside beforePhase method");

Finally, the bottom line is that the afterPhase(PhaseEvent) and beforePhase(PhaseEvent) methods must not modify class-level mutable (non-final) variables, or any type of memory that is shared by other threads, unless the methods are synchronized or access to the shared data is synchronized. Having said that, relying on synchronization can sometimes cause bottlenecks in an application because it causes other threads to block.



Internationalizing JSF Portlets

Company Blogs May 10, 2012 By Neil Griffin Staff

Note: This blog post has been moved to the Liferay Faces Wiki.

Migrating to Liferay Faces

Company Blogs April 10, 2012 By Neil Griffin Staff

The Liferay Faces Reference Documentation has a new chapter titled "Migration Guide" that discusses migration issues that you may encounter when migrating from projects to Liferay Faces. By way of preview, here are a list of topics discussed:

  • BridgeRequestAttributeListener
  • Configuration Option Names
  • File Upload
  • Facelet Tag Library Namespaces
  • GenericFacesPortlet
  • LiferayFacesContext
  • Logging
  • Portlet Preferences

For more information, you can download the latest version of the PDF from the following page:

If anyone encounters additional migration issues, please comment below and we'll try to get the documentation updated accordingly. Thanks everyone!

New Liferay Faces project at

Company Blogs April 3, 2012 By Neil Griffin Staff

Press Release

On April 3, 2012 a press release was issued announcing that Liferay will be assuming leadership for the community. I'm very excited about this development and wanted to take a moment to provide some additional details.


The community was formed by Liferay Platinum Partner Triton Services, Inc. and Silver Partner Mimacom AG in order to provide support for JSF 2 inside of Liferay Portal. Here at Liferay, we have seen strong demand for JSF portlets from Liferay’s community and customers. Triton and Mimacom recently contributed the projects from to and Liferay has committed to moving the technology forward.

Liferay Faces

Liferay FacesThe website is being transitioned to its new home at

The projects at have been repackaged under a new umbrella project called Liferay Faces along with some name changes:

Additionally, the java packaging namespace has been refactored: org.portletfaces -> com.liferay

Upcoming Release

The first release of Liferay Faces is version 3.0.0-BETA1 and is scheduled for Friday April 6, 2012. The 3.0.x branch is designed to be used with Liferay 6.0.x based portals. After the release, work will begin on the 3.1.x branch which will target Liferay 6.1.x based portals.

In this first release, the Liferay Faces Alloy and Liferay Facs Portal projects have received some minor bug fixes, but Liferay Faces Bridge has undergone significant development since the last release of PortletFaces Bridge 2.0.2. Specifically, we've focussed on developing the remaining features of JSR 329 and have made great progress towards getting the bridge to pass all of the tests in the JSR 329 Test Compatibility Kit (TCK).

Liferay IDE

Features and support for developing portlets with Liferay Faces will be included in upcoming releases of Liferay IDE and Liferay Developer Studio.


The forums at were migrated on April 3, 2012 to their new home at

If your account at was created prior to January 19, 2012 had the same email address as your account at then the posts you made at should still be authored with your name. Otherwise the author will appear as "PortletFaces Community Member." If you're waiting on an answer on a particular forum post, I recommend that you make a comment on that post in order to make sure you get email alerts. Also, I recommend subscribing to the Liferay Faces forum in general.


The issues at will be consolidated into a single JIRA project called FACES and will soon be migrated to their new home at

If your account at had the same username as your account at then issues you created (or commented on) should continue to be authored with your name. If you didn't have an account at then a new account will automatically be created once the migration is complete. If that's the case, then you will probably have to use the "forgot my password" feature in order to setup your password in the new system.


I renamed my @portletfaces account at twitter to @liferayfaces. If you were following @portletfaces then you will automatically be following @liferayfaces.

Enterprise Subscription & Support

As soon as Liferay Faces 3.0.0 and 3.1.0 reach their first production release, Liferay EE customers will enjoy support for Liferay Faces according to the Service Level Agreement (SLA) associated with Liferay Enterprise Subscription & Support (ESS).

License Change

The projects at were released under the Apache 2 license, but the Liferay Faces project will be released under the LGPL 2.1 license which is already used by Liferay on other projects.

Thank You

I wanted to extend my personal thanks to my dear friends at Triton and Mimacom for making this contribution, and to Liferay for taking the lead moving forward. I also want to thank the faithful members of the community for their support and kind words of encouragement.


Utilizing instance storage (ephemeral storage) with RHEL on Amazon EC2

Company Blogs September 2, 2011 By Neil Griffin Staff


I recently had the opportunity to launch an Amazon EC2 instance and setup Liferay & MySQL. There were a couple of hurdles that I had to overcome, so I thought I would share the solutions I came up with.


Storage: Ephemeral or EBS?

When you launch an RHEL instance on EC2, the disk storage that is provided is a VERY SMALL (7 GB or less) root partition that is contained within the instance itself. This type of storage is called ephemeral. The benefit of ephemeral storage is that it doesn't cost any extra money. The drawback is that it can't participate in the EBS backup solution provided by Amazon -- you'll need to backup files across the network instead. Depending on the size of the instance, you will be given additional ephemeral storage, which is where you can potentially store data or install an app server for Liferay. The Amazon documentation indicates that this will be mounted automatically on /ephemeral0 but I found that this wasn't the case. You will need to use the "fdisk -l" command to find out the device name of the additional ephemeral storage. In my case, I found that the device was named /dev/xvdj. However, there was no filesystem on it, and it wasn't mounted. So you'll need to execute commands like the following:
mkfs -t ext4 /dev/xvdj
mkdir /ephemeral0
echo "/dev/xvdj /ephemeral0 ext4 defaults 1 2" >> /etc/fstab
mount /ephemeral0
The alternative storage is called EBS. The benefit is that it can participate in the Amazon backup solution, but the drawback is that it costs extra money. If you want to use EBS instead of ephemeral, you can create EBS Volumes using the Amazon Management Console and then attach them to your instance. Bear in mind that you'll still need to discover the device with "fdisk -l", put a filesystem on it, mount it, etc.

Moving MySQL to the additional ephemeral storage

In order to utilize the larger ephemeral storage for database files, I needed to move the MySQL data files from /var/lib/mysql to a filesystem mounted on /ephemeral0. I tried to follow the instructions in section 10.4.1 of the HREL documentation titled "MySQL Changing Database Location" but when I restarted mysqld via "service mysqld start" it reported FAILED, and the following was found in /var/log/mysqld.log:
110902 11:35:42 mysqld_safe Starting mysqld daemon with databases from /opt/var/mysql
110902 11:35:42 [Warning] Can't create test file /opt/var/mysql/domU-12-31-39-09-AE-12.lower-test
110902 11:35:42 [Warning] Can't create test file /opt/var/mysql/domU-12-31-39-09-AE-12.lower-test
/usr/libexec/mysqld: Can't change dir to '/opt/var/mysql/' (Errcode: 13)
110902 11:35:42 [ERROR] Aborting
The irony here is that section 10.4.1 is meant to show you how to avoid this error.  So I had to find a different approach, and found inspiration in the following articles:
The strategy I used was to copy the MySQL files to /ephemeral0, and then mount the ephemeral storage directory back to /var/lib/mysql
Step 1: Stop the MySQL server and copy the data files over to /ephemeral0:
[root@server]# service mysqld stop
[root@server]# cd /var/lib
[root@server]# tar cf - mysql/ --selinux | (cd /ephemeral0/var/lib; tar xvfp -)
NOTE: It's really important to keep the --selinux switch so that the SELinux context for each file will be saved in the tarball. Also, it's really important to keep the "p" switch upon extraction, so that file permissions will be preserved.
Step 2: Determine the existing selinux settings and re-apply them on a similar var/lib folder structure on /ephemeral0:
[root@server]# ls -lZ / | grep var
drwxr-xr-x. root root system_u:object_r:var_t:s0       var
[root@server]# chcon -u system_u -r object_r -t var_t /ephemeral0/var
[root@server]# ls -lZ /var | grep lib
drwxr-xr-x. root   root   system_u:object_r:var_lib_t:s0   lib
[root@server]# chcon -u system_u -r object_r -t var_t /ephemeral0/var/lib
[root@server]# ls -lZ /var/lib | grep mysql
drwxr-xr-x. mysql     mysql    system_u:object_r:mysqld_db_t:s0 mysql
Step 3: Re-create the /var/lib/mysql mount point and preserve ownership/group/selinux settings:
[root@server]# cd /var/lib
[root@server]# mv mysql mysql.orig
[root@server]# mkdir mysql
[root@server]# chown mysql mysql
[root@server]# chgrp mysql mysql
[root@server]# chcon -u system_u -r object_r -t mysqld_db_t mysql
Step 4: Mount the directory that contains the MySQL data onto the /var/lib/mysql mount point and restart MySQL:
[root@server]# echo "/ephemeral0/var/lib/mysql /var/lib/mysql none bind bind" >> /etc/fstab
[root@server]# mount /var/lib/mysql
[root@server]# service mysqld start


The benefit of using this approach is that I didn't have to change any of the settings in the /etc/my.cnf configuration file. Also, I didn't have to fight the selinux security context problem. This approach can also be used for mounting other folders like /opt in order to utilize ephemeral storage.

Fixing SunCertPathBuilderException caused by Maven downloading from self-signed repository

Company Blogs August 11, 2011 By Neil Griffin Staff

If you have a Maven repository running under https with a self-signed certificate, then building a Maven project can report the following error:

Error transferring file: PKIX path building failed: unable to find valid certification path to requested target

There was an Oracle blog posted by Andreas Sterbenz back on Oct 09, 2006 that helped me diagnose the problem, but that blog is no longer available. Thankfully Andreas' blog was re-posted here. For additional information, I found another blog post that was helpful.

Anyways, I fixed this problem by downloading and compiling the source for and running the following command:


This generated a file named jssecacerts in the current directory.

On Windows/Linux, this file needs to be copied to the JAVA_HOME/jre/lib/security/ directory.

On Mac needs to be copied to the JAVA_HOME/lib/security/ directory.

After I did this, Maven was able to download the artifacts from the self-signed repository.



Lightning fast portlet development with JRebel

Company Blogs July 22, 2011 By Neil Griffin Staff

Back in April of this year I had the opportunity to speak at the CON-FESS conference in Vienna, Austria. One of the exhibitors there was and I had the privilege of sitting next to founder Jevgeni Kabanov over dinner one night.

Jevgeni described the benefits of JRebel, a JVM-plugin that makes it possible for Java developers to instantly see any code change made to an app without redeploying. Needless to say, redeploying WARs is part of the very fabric of a Liferay portlet developer's life, so I knew that I had to give this product a try with my next ICEFaces 2 portlet with PortletFaces Bridge.

and to my utter amazement... IT WORKED!!!

Simply put, this product is a MUST HAVE for Liferay portlet developers. I'm hooked! Over the past 6 years of portlet development, this product could have saved me COUNTLESS hours of development time waiting for redeploys.

The JRebel documentation is quite good, but here are some quick instructions for how to get started with JRebel and the Liferay+Tomcat bundle:

  1. Download JRebel (30 day free trial)
  2. Install JRebel to it's default location. For example, on the Mac: /Applications/ZeroTurnaround/JRebel
  3. Set the REBEL_HOME environment variable. On the Mac, I find it's best to do this inside the $HOME/.MacOSX/environment.plist file:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
    <plist version="1.0"> <dict>
  4. On Mac, add the following to the LIFERAY_HOME/tomcat/bin/ script:
  5. On Windows, add the following to the LIFERAY_HOME/tomcat/bin/setenv.bat file:
  6. Create a rebel.xml file that will be deployed in the runtime classpath of the WAR:Note that if you install the JRebel plugin for Eclipse, IntelliJ 8/9, IntelliJ X, or NetBeans) you can right click on the project and have the IDE generate the file. You can also generate the rebel.xml file with a Maven goal.
    • Maven: src/main/resources/rebel.xml
    • Liferay Plugins SDK: docroot/WEB-INF/src/rebel.xml
  7. Start Tomcat with the liferay/tomcat/bin/ script (startup.bat on Windows)
  8. Deploy the WAR to the Liferay /deploy folder
  9. Make some Java code changes to your app and click Save in your IDE
  10. Reload your browser, and voila! Instant changes! No redeploy!


Working with JSF's <f:convertDateTime /> and java.util.Date

Company Blogs July 30, 2010 By Neil Griffin Staff

During a recent class I taught on ICEfaces, one of my students asked me why the calendar was often one day off from what got posted back to the model managed-bean setter.

For example:
// Facelets XHTML Markup:
<ice:selectInputDate value="#{modelManagedBean.dateOfBirth}">
    <f:convertDateTime pattern="MM/dd/yyyy" />

// Java Code
import java.util.Date;
public class ModelManagedBean {

  private Date dateOfBirth;

  public Date getDateOfBirth() {
    return dateOfBirth;

  public Date setDateOfBirth(Date dateOfBirth) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy hh:mm z");
    // The value printed here during postback was often wrong by 1 day
    System.out.println("dateOfBirth=" + dateFormat.format(dateOfBirth));
    this.dateOfBirth = dateOfBirth;

Basically, the JSF DateTimeConverter Javadoc states that if the timeZone attribute is not specified, then the default is GMT. But when you create an instance of java.text.SimpleDateFormat, the default TimeZone is equal to TimeZone.getDefault() which (for me) was EST. So the solution I explained to my students was to make sure we were comparing apples-to-apples the whole way through, by using GMT for the SimpleDateFormat printing, like this:


And of course, I think it's the recommended practice to run your application server JVM in GMT. That would eliminate the problem entirely. But when you're using Eclipse and Tomcat for development, that's typically not the case.


JSF 2.0 Complete Reference, with JSF Portlet Appendix

Company Blogs February 3, 2010 By Neil Griffin Staff


JSF 2.0 Complete Reference with JSF Portlet Appendix

I'm pleased to announce the new JSF 2.0 Complete Reference book by Ed Burns and Chris Schalk, published by McGraw-Hill. During the planning stages, Ed asked me to be a contributing author and help bring the first edition of the book up-to-date with JSF 2.0, and also to write a JSF Portlet Appendix.

As listed in the Table of Contents, Appendix A discusses the following Topics:

  • Overview of Portlet 1.0 and 2.0
    • Portlet Lifecycle
    • Portlet Modes
    • Portlet Window States
    • Portlet Preferences
    • Inter-Portlet Communication
  • JSF Portlet Development
    • JSF Portlet Bridges
    • JSF Portlet View Handlers
    • JSF ExernalContext and the Portlet API
    • JSF and Portlet Preferences
    • JSF and Inter-Portlet Communication
  • ICEfaces Portlet Development
    • ICEfaces Ajax with Partial Submit
    • ICEfaces Direct-to-DOM RenderKit
    • The ice:portlet Tag
    • ICEfaces 1.x Portlet Bridge
    • ICEfaces 1.x D2DFaceletViewHandler
    • ICEfaces 1.x and Portlet Window States
    • ICEfaces Portlets and Concurrent DOM Views
    • ICEfaces 1.x Extended Request Scope
    • ICEfaces Ajax Push and Inter-Portlet Communication
    • ICEfaces Themes and Portal Themes
    • ICEfaces Themes and Liferay Themes
    • ICEfaces Ajax Bridge and Liferay Portal
    • ICEfaces Portlets and Liferay Request Attributes
  • PortletFaces
    • Downloading PortletFaces
    • PortletFacesContext
    • PortletFaces Tags
    • PortletFaces and Portlet Preferences
    • PortletFaces and Expression Language Additions
    • PortletFaces and Localization
    • Liferay Language Portlet Integration
    • Improved Integration Between Liferay and ICEfaces 1.x

This week (Feb 2nd to Feb 5th) Ed Burns & Chris Schalk will be helping to answer questions about the new book at JavaRanch. In addition, JavaRanch will be giving away a free copy of the book.

Finally I'd like to express my gratitude to Liferay, ICEsoft, Mimacom, and Triton for their generous support in making the JSF Portlet Appendix possible.

JSF 2.0 Test Drive Part 2: Developing a Website with Facelets Templating

Company Blogs October 1, 2009 By Neil Griffin Staff

As part of my work on JSR 314 (JSF 2.0) I've been reviewing the specification, Javadocs, and tag library docs for accuracy. One way I do this is to make examples that test drive what the documentation says JSF 2.0 will do.

In Part 1 of this series, I showed how to develop an Ajaxified JSF 2.0 Facelet Composite Component.

Now here's Part 2 of my JSF 2.0 Test Drive... Developing a Website with Facelets Templating

Facelets Templating

Templating -- what's that? Well templating refers to a technology that you would use to control the layout and content of a website. It's kind of like Liferay Portal's "Layout Template" feature that lets you control how portlets are arranged on the portal page.

The premiere view-handler in JSF 2.0 is Facelets, which provides a powerful templating engine designed especially for JSF. Websites typically have a layout of sections that is common for all pages: header, navigation, main content, and footer. That's where Facelets Templating comes in to save the day.

Downloadable Source Code

The Maven 2 project source code is licensed under the MPL 1.1 and is available at the edoras framework SVN repo:

Home Page Screen Shot

Here is a screen shot of the home page for the website:

The "Welcome Our Company Website" light-gray rectangle at the top is the "header" of the website. This is kind of like a banner that is to appear at the top of every web page in the site. It typically never changes.

The Home, Products, and Contact Us links are part of the "navigation" for the site. The links typically change a little from page to page in a real world site.

The "Welcome to the HOME page" dark-gray rectangle on the right is the "main" content for each page. This is the content in this part typically changes quite a bit for each page.

The "Copyright" light-gray rectangle on the bottom is the "footer" for the website. Like the header, it typically never changes.

Template Source Markup: template.xhtml

Here is the markup for the template. It's basically a Facelets f:view that specifies an h:panelGroup (renders a <div> layer) for the header, and another for the footer. Note that those sections use the Facelets ui:include tag in order to insert the contents of the header and footer info, which lives in separate XHTML files. In the middle is an h:panelGrid, which renders a two-column HTML <table>. Note the Facelets ui:insert tags -- they are kind of like markers that indicate that something will be inserted at runtime. More on that when we look at the ui:define tags in the Home page. Also, note that the Facelets ui:debug tag is specified in the template -- that's kind of a best practice for helping JSF developers debug the server-side state of things.

<f:view xmlns="" xmlns:f=""
  xmlns:h="" xmlns:ui=""

  <!-- Enables CTRL+SHIFT+D for activating Facelets debug window -->
  <ui:debug />

    <ui:insert name="htmlHead" />
    <link rel="stylesheet" type="text/css" href="css/template.css" />
    <h:panelGroup layout="block" styleClass="header">
      <ui:include src="/WEB-INF/includes/header.xhtml" />
    <h:panelGrid columns="2" columnClasses="nav-col, main-col" styleClass="middle-table">
      <h:panelGroup layout="block">
          <ui:insert name="navigation" />
      <h:panelGroup layout="block">
        <ui:insert name="main" />
    <h:panelGroup layout="block" styleClass="footer">
      <ui:include src="/WEB-INF/includes/footer.xhtml" />

Home Page Source Markup: home.xhtml

Here's the markup for the home page. Note that it's not a Facelets f:view at all -- instead its a ui:composition that specifies template.xhtml as the Facelet template to be used for rendering. The main thing to point out here is that the ui:define tag "defines" the content that is to be inserted into the template via the corresponding ui:insert tag found in the template.

<ui:composition xmlns="" xmlns:h=""
  xmlns:f="" xmlns:ui=""

  <ui:define name="htmlHead">
    <meta name="description" content="Our Company Home Page" />
    <title>Our Company - Home</title>

  <ui:define name="navigation">
    <h:outputText styleClass="selected" value="Home" />
    <h:commandLink action="products" value="Products" />
    <h:commandLink action="contact-us" value="Contact Us" />

  <ui:define name="main">
    <h:outputText value="Welcome to the HOME page." />


The remainer of the files (header, footer, products page, contact-us page) are the SVN repos.

Again, hope you enjoyed seeing JSF 2.0 in action! Good stuff ahead!

JSF 2.0 Test Drive Part 1: Developing a Facelet Composite Component

Company Blogs October 1, 2009 By Neil Griffin Staff


As part of my work on JSR 314 (JSF 2.0) I've been reviewing the specification, Javadocs, and tag library docs for accuracy. One way I do this is to make examples that test drive what the documentation says JSF 2.0 will do.

To that end, here's Part 1 of my JSF 2.0 Test Drive... Developing a Facelet Composite Component

Composite Component Tag

  <testcc:inputColor />


An Ajaxified JSF 2.0 Facelet Composite Component that lets you choose an RGB color.

Downloadable Source Code

The Maven 2 project source code is licensed under the MPL 1.1 and is available at the edoras framework SVN repo:

Screen Shot


JSF 2.0 Terminology

In order to understand some of the terms used in the example, let's talk about some new JSF 2.0 Facelet terminology found in the documentation:

Composite Component: Refers to an XHTML file that contains a piece of reusable markup that is encapsulated by the ui:component tag
Composite Component Author: Refers to the person that develops the composite component
Composite Component Tag: Refers to a tag like <testcc:inputColor /> that lets folks create instances of the composite component
Using Page: Refers to the Facelet XHTML f:view that contains the composite component tag
Page Author: Refers to the person that that creates an instance of the composite component on a using page.

Composite Component Source: inputColor.xhtml

Here's the markup for the component itself. Note how JSF 2.0 now has a nice ui:interface section for defining the usage contract for the page author to abide by, and a ui:implementation section for hiding the inner workings of the component itself (the reusable markup). Also note that I didn't have to write any Javascript to perform Ajax updates in the DOM -- JSF 2.0 has that built-in with the f:ajax tag. The render attribute of f:ajax specifies a space-delimited list of "ids" that are to be re-rendered after the form is submitted via XmlHttpRequest().

<ui:component xmlns="" xmlns:c=""
  xmlns:f="" xmlns:h=""
  xmlns:ui="" xmlns:cc=""

    <cc:attribute name="value" required="true" type="org.edorasframework.example.Color">
      <cc:attribute name="red" required="true" />
      <cc:attribute name="green" required="true" />
      <cc:attribute name="blue" required="true" />
    <cc:actionSource name="colorPalette" targets="redSelector greenSelector blueSelector" />
    <cc:editableValueHolder name="colorFields" targets="redInputText greenInputText blueInputText" />
    <cc:facet name="header" required="true" />

    <cc:renderFacet name="header" />
    <f:ajax render="preview kids">
      <h:panelGrid columns="2">
        <h:outputLabel value="R:" />
        <h:inputText id="redInputText" value="#{}">
          <f:validateLongRange minimum="0" maximum="255" />
        <h:outputLabel value="G:" />
        <h:inputText id="greenInputText" value="#{}">
          <f:validateLongRange minimum="0" maximum="255" />
        <h:outputLabel value="B:" />
        <h:inputText id="blueInputText" value="#{}">
          <f:validateLongRange minimum="0" maximum="255" />
    <h:outputText value="Color Preview: " />
    <c:set value="#{}" var="red" />
    <c:set value="#{}" var="green" />
    <c:set value="#{}" var="blue" />
    <c:set value="#{red},#{green},#{blue}" var="rgb" />
    <h:outputText id="preview" value=" " style="border: 1px solid; padding: 1px 10px; background-color: rgb(#{rgb});" />
    <f:ajax render="redInputText greenInputText blueInputText preview kids">
      <h:panelGrid border="1" columns="3">
        <f:facet name="header">
          <h:outputText value="Color Palette" />
        <h:commandLink id="redSelector" value="Red">
          <f:setPropertyActionListener target="#{}" value="255" />
          <f:setPropertyActionListener target="#{}" value="0" />
          <f:setPropertyActionListener target="#{}" value="0" />
        <h:commandLink id="greenSelector" value="Green">
          <f:setPropertyActionListener target="#{}" value="0" />
          <f:setPropertyActionListener target="#{}" value="255" />
          <f:setPropertyActionListener target="#{}" value="0" />
        <h:commandLink id="blueSelector" value="Blue">
          <f:setPropertyActionListener target="#{}" value="0" />
          <f:setPropertyActionListener target="#{}" value="0" />
          <f:setPropertyActionListener target="#{}" value="255" />
    <br />
    <h:panelGroup id="kids">
      <cc:insertChildren />


Using Page Source: usingPage.xhtml

Here's what the using page looks like, and how it creates an instance of the composite component by using a composite component tag. Note that with JSF 2.0, you can attach action-listeners and value-change-listeners to composite components. Additionally, you can specify children inside the composite component tag, provided that the composite component author uses the ui:insertChildren tag to place the children somewhere in the reusable markup. The testcc:inputColor tag shown below inserts an h:panelGrid as a child, which shows the "You Selected..." part to the user.

<f:view xmlns="" xmlns:f=""
  xmlns:h="" xmlns:testcc=""
  xmlns:ui="" xmlns:xsi=""
    <title>Using Page</title>
      <h:messages />
      <testcc:inputColor value="#{modelManagedBean.color}">

        <f:facet name="header">
          <h:outputText value="Please choose a color" />

        <f:actionListener for="colorPalette" type="org.edorasframework.example.ColorActionListener" />

        <f:valueChangeListener for="colorFields" type="org.edorasframework.example.ColorValueChangeListener" />

        The following h:panelGrid will be used by the cc:insertChildren tag in the
        cc:implementation section of the  testcc:inputColor composite component.
        <h:panelGrid columns="2">
          <f:facet name="header">
            <h:outputText value="You Selected: " />
          <h:outputLabel value="Red:" />
          <h:outputText value="#{}" />
          <h:outputLabel value="Green:" />
          <h:outputText value="#{}" />
          <h:outputLabel value="Blue:" />
          <h:outputText value="#{}" />

      <br />
      <h:commandButton value="Submit" />

Composite Component Value POJO:

Here is the POJO that is used to supply a value to the composite component:

package org.edorasframework.example;


 * This class provides a way of representing a color as an RGB triplet.
 * @author  "Neil Griffin"
public class Color implements Serializable {

  private static final long serialVersionUID = -3810147232196826614L;

  private int red;
  private int green;
  private int blue;

  public int getBlue() {
    return blue;

  public int getGreen() {
    return green;

  public int getRed() {
    return red;

  public void setBlue(int blue) { = blue;

  public void setGreen(int green) { = green;

  public void setRed(int red) { = red;


The remainer of the files (action listener, value change listener, model managed bean) are all available from the SVN repos.

Anyways, hope you enjoyed seeing JSF 2.0 in action! Good stuff ahead!

There's Gold in that Portal!

Company Blogs October 1, 2009 By Neil Griffin Staff


On a recent trip to Colorado I had the opportunity to go panning for gold in a stream and take a tour of a gold mine. There may be a lot of gold in the West Portal (shown below), but rest assured I'm still hooked on Liferay. Although I enjoyed my time out there, it is good to be back home in Sunny, FL.


Showing 21 - 40 of 50 results.
Items 20
of 3