Recent Bloggers

Ruud Kluivers

16 Mensagens
5 de Março de 2015

James Falkner

103 Mensagens
3 de Março de 2015

Shannon Chang

2 Mensagens
3 de Março de 2015

Fady Hakim

5 Mensagens
1 de Março de 2015

Andrea Di Giorgi

4 Mensagens
27 de Fevereiro de 2015

David Kubitza

3 Mensagens
27 de Fevereiro de 2015

Brett S. Kobold

1 Mensagens
26 de Fevereiro de 2015

Angela Wu

5 Mensagens
26 de Fevereiro de 2015

Jorge Ferrer

60 Mensagens
25 de Fevereiro de 2015

Jose M. Navarro

3 Mensagens
22 de Fevereiro de 2015

Announcement: Liferay Faces 3.1.0-RC2 Released

Company Blogs 14 de Julho de 2012 Por 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 1 de Junho de 2012 Por 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 30 de Maio de 2012 Por 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 10 de Maio de 2012 Por Neil Griffin Staff

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

Migrating to Liferay Faces

Company Blogs 10 de Abril de 2012 Por 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 3 de Abril de 2012 Por 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 2 de Setembro de 2011 Por 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 11 de Agosto de 2011 Por 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 22 de Julho de 2011 Por 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 30 de Julho de 2010 Por 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 3 de Fevereiro de 2010 Por 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 1 de Outubro de 2009 Por 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 1 de Outubro de 2009 Por 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 1 de Outubro de 2009 Por 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.


Jazoon 2009 Conference Video: Like Peanut Butter & Chocolate (or Ajax Meets Portals)

Company Blogs 17 de Setembro de 2009 Por Neil Griffin Staff

Here is the video recording of the Jazoon 2009 talk I was privileged to do with Micha Kiener of Mimacom:

Presentation Title: Like Peanut Butter & Chocolate (or Ajax Meets Portals)

Direct link

Description: Discussion of how ICEfaces and Ajax Push can be used to perform Inter-Portlet-Communication (IPC) and also provides a rich Ajax-powered user experience.

You may need to click the triangle (play) button to get the movie to play.

Conference Talks: Social Networking Portlets with ICEfaces Ajax Push

Company Blogs 19 de Maio de 2009 Por Neil Griffin Staff

I have the privilege of speaking about Social Networking Portlets with ICEfaces Ajax Push at the following three conferences:

I am speaking at JSF Summit 2009

JSF Summit

Dec 1-4, 2009
Orlando, FL

I am speaking at CommunityOne 2009

CommunityOne West
Here I'll be co-speaking with Ed Burns, who is co-chairman of the JSR 314 (JSF 2.0) Expert Group

June 1-3, 2009
The Moscone Center
San Francisco

This is an open developer conference. Monday 6/1 is free!

Liferay East Coast User Conference

May 21, 2009
Rivet Logic Corporation (Training Center)
1775 Wiehle Avenue, 3rd floor
Reston, VA 20190

The talks will focus on the power and elegance of Liferay + ICEfaces Ajax Push, and how these technologies can be used together to create Social Networking portlets with Liferay Portal.

Social networking is a natural addition to portals, already a meeting place for applications. Diverse systems and users can be brought together for web-based communication and collaboration. When introduced to Ajax Push, Portlets can provide real-timecommunication features, such as presence, chat, and new forms of application-specific interaction.

Here's a screen shot of two portlets I'll be demontrating: ICEfaces Friends, and ICEfaces Chat:

The friends portlet is presence-aware, in that it has an application-scoped bean that listens to users logging-in/out of the portal. When it receives one of those events, ICEfaces Ajax Push will fire a visual effect, alerting the user of the friend's online status. If online, then the chat icon is activated. If the user clicks on the chat icon, then ICEfaces Ajax Push is used to achieve inter-portlet communication with the Chat portlet on the right. A new chat session is created, and users can chat with one another in near-real-time, again thanks to ICEfaces Ajax Push.

One of the things that I love about JSF, is the elegant, clean separation of the Model, View, and Controller concerns of the MVC design pattern. Case in point: Here's the entire XHTML markup for the Chat portlet:.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<f:view xmlns:c=""
    <ice:portlet styleClass="portlet-content">
        <sn:styling />
            <ice:messages />
            <c:set value="#{chatRoomsModel.roomsWithUser}" var="chatRoomsWithUser" />
            <ice:panelTabSet rendered="#{!empty chatRoomsWithUser}" value="#{chatRoomsWithUser}" var="chatRoom">
                <ice:panelTab label="#{}">
                    <ice:panelGroup id="scroller" style="overflow: auto; width: 100%; height: 250px;">
                        <ice:dataTable rowClasses="results-row,results-row alt"
                                width="100%" value="#{chatRoom.chatMessages}" var="chatMessage">
                            <ice:column style="width: 50px;">
                                    portraitStyleClass="avatar" portraitWidth="30px" showJobTitle="false"
                                    showOnlineStatus="false" user="#{chatMessage.user}" />
                                <ice:outputText value="#{}">
                                    <f:convertDateTime pattern="MM/dd/yyyy hh:mm:ss a" />
                                <br />
                                <ice:outputText value="#{chatMessage.text}" />
                    <ice:inputText action="#{chatRoomsBacking.addMessage(chatRoom)}" value="#{chatRoomsBacking.messageText}" />
                    <ice:commandButton action="#{chatRoomsBacking.addMessage(chatRoom)}" value="#{message['add-message']}" />


Also, these portlets make heavy use of Facelets Composite Components, and demonstrate how you can create new JSF components entirely with XHTML markup.

Hope to see you at one of these conferences!

Podcast interview by Kito Mann of JSF Central regarding Liferay and ICEfaces

Company Blogs 6 de Maio de 2009 Por Neil Griffin Staff

Back in October 2008 at the JSFOne conference, I was interviewed by Kito Mann of JSF Central regarding Liferay and ICEfaces. The podcast and transcript were recently published at the JSF Central website:

Among the topics discussed are:

  • Liferay and JSF
  • Liferay and ICEfaces
  • JSR-314 JSF 2.0
  • JSR-301 JSF Portlet Bridge Standard
  • Liferay Roles and Security

Making distinctions between different kinds of JSF managed-beans

Company Blogs 13 de Abril de 2009 Por Neil Griffin Staff

JSF has a simple Inversion-of-Control (IoC) container called the JSF Managed Bean Facility (MBF). Although it has a verbose XML syntax, and is not as robust as the Spring BeanFactory, PicoContainer, or the JBoss Microcontainer, the MBF does have the basics of an IoC container, and offers features like dependency injection.

When a POJO is managed by the JSF MBF, it is typically referred to as a managed-bean. But if you're going to create a maintainable JSF webapp/portlet, it is necessary to distinguish between different kinds of managed-beans. This practice will also preserve the clean separation of concerns that JSF provides by implementing the Model-View-Controller (MVC) design pattern:


Managed-Bean Type Nickname Typical Scope
Model Managed-Bean model-bean session

Description: This type of managed-bean participates in the "Model" concern of the MVC design pattern. When you see the word "model" -- think DATA. A JSF model-bean should be a POJO that follows the JavaBean design pattern with getters/setters encapsulating properties. The most common use case for a model bean is to be a database entity, or to simply represent a set of rows from the result set of a database query.

Backing Managed-Bean backing-bean request

Description: This type of managed-bean participates in the "View" concern of the MVC design pattern. The purpose of a backing-bean is to support UI logic, and has a 1::1 relationship with a JSF view, or a JSF form in a Facelet composition. Although it typically has JavaBean-style properties with associated getters/setters, these are properties of the View -- not of the underlying application data model. JSF backing-beans may also have JSF actionListener and valueChangeListener methods.

Controller Managed-Bean controller-bean request

Description: This type of managed-bean participates in the "Controller" concern of the MVC design pattern. The purpose of a controller bean is to execute some kind of business logic and return a navigation outcome to the JSF navigation-handler. JSF controller-beans typically have JSF action methods (and not actionListener methods).

Support Managed-Bean support-bean session / application

Description: This type of bean "supports" one or more views in the "View" concern of the MVC design pattern. The typical use case is supplying an ArrayList<SelectItem> to JSF h:selectOneMenu drop-down lists that appear in more than one JSF view. If the data in the dropdown lists is particular to the user, then the bean would be kept in session scope. However, if the data applies to all users (such as a dropdown lists of provinces), then the bean would be kept in application scope, so that it can be cached for all users.

Utility Managed-Bean utility-bean application

Description: This type of bean provides some type of "utility" function to one or more JSF views. A good example of this might be a FileUpload bean that can be reused in multiple web applications.


Now... One of the main benefits in making fine distinctions like this is loose coupling. What's that you ask? Well let's first take a look at an example of tight coupling, where MVC concerns can be smashed/confused into a single managed-bean:


public class ModelAndBackingAndControllerBean {

	private String fullName; // model-bean property
	private boolean privacyRendered; // backing-bean property

	// model-bean getter
	public String getFullName() {
		return fullName;
	// model-bean setter
	public void setFullName(String fullName) {
		this.fullName = fullName;

	// backing-bean getter
	public boolean isPrivacyRendered() {
		return privacyRendered;

	// backing-bean setter
	public void setPrivacyRendered(boolean privacyRendered) {
		this.privacyRendered = privacyRendered;

	// backing-bean actionListener for UI support logic
	public void togglePrivacySection(ActionEvent actionEvent) {
		privacyRendered = !privacyRendered;

	// controller-bean business logic
	public String submit() {
		System.out.println("fullName=" + fullName);
		return "success";

The problem here is that the bean would have to be kept in session scope because of the model-bean property. Additionally, what if we wanted to do some unit testing with mock model data? Can't do it. So in order to fix these problems, and to promote loose coupling, we would have three separate Java classes:

public class ModelBean {

	private String fullName;

	public void setFullName(String fullName) {
		this.fullName = fullName;

	public String getFullName() {
		return fullName;

public class BackingBean {

	private boolean privacyRendered;

	public void setPrivacyRendered(boolean privacyRendered) {
		this.privacyRendered = privacyRendered;

	public boolean isPrivacyRendered() {
		return privacyRendered;

	public void togglePrivacySection(ActionEvent actionEvent) {
		privacyRendered = !privacyRendered;


public class ControllerBean {

	private ModelBean modelBean;
	public ModelBean getModelBean() {
		return modelBean;

	public void setModelBean(ModelBean modelBean) {
		// Dependency injected from the JSF managed-bean facility
		this.modelBean = modelBean;

	public String submit() {
    	System.out.println("fullName=" + getModelBean().getFullName());
        return "success";



Now that the beans are found in different classes, they can all be kept in their appropriate scopes. The model-bean can be kept in session scope, and the backing-bean and controller-bean can be kept in request scope, thus saving memory resources on the server.

Finally, we can use the dependency injection features of the JSF MBF in order to inject the model-bean into the controller-bean. This can be seen in the following WEB-INF/faces-config.xml example, where the #{modelBean} Expression Language (EL) binding is used:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="" xmlns:xsi=""



Webinar: Filthy Rich Portlets with ICEfaces and Liferay

Company Blogs 30 de Setembro de 2008 Por Neil Griffin Staff

UPDATE: March 17, 2011

This blog post refers to an old version of ICEfaces (1.8). I would encourage you to try out the ICEfaces 2 versions of these portlets here:

ORIGINAL POST FOLLOWS: September 30, 2008

Note: An archive of the webinar is now available on ICEfaces .org in both .wmv and quicktime: (3rd item in the Archive Webinar list)

Also, here is a video+transcript of a similar presentation given at the JSFOne conference:

Webinar Title: Filthy Rich Portlets with ICEfaces and Liferay

Webinar Date/Time: Tuesday, October 14, 2008 1:00 PM - 2:00 PM EDT

Webinar Link:

Webinar Slides and Demo Downloads:

The sources are meant to be extracted into the "plugins" folder of the Liferay Plugins SDK. Fore more info, download the the Liferay Plugins SDK documentation.

Webinar Overview:

  • Portals and Portlets
  • Liferay Portal
  • JSF Portlets
  • ICEfaces Portlets
  • Standard Inter-Portlet Communication
  • Ajax Push Inter-Portlet Communication


Filthy Rich Portlets with ICEfaces at the JSFOne Conference!

Company Blogs 20 de Agosto de 2008 Por Neil Griffin Staff


Here is a video+transcript of the presentation given at the JSFOne conference:

And here is a similar webinar on ICEfaces .org in both .wmv and quicktime: (3rd item in the Archive Webinar list)

The JSFOne conference is being held from Thu 9/4/2008 - Sat 9/6/2008 in the Washington, DC area. Specifically, the event is being held at the Sheraton Premier Hotel in Vienna, VA.


I have the great privilege of speaking at the conference, and will be doing a talk titled "Filthy Rich Portlets with ICEfaces and Liferay." To that end, I recently committed a new portlet to the Liferay Plugins trunk: sample-icefaces-ipc-ajax-push-portlet.

It's actually one web archive (WAR) that contains two portlets. The Customers portlet simply shows a list of customers:

When the user clicks on a customer, ICEfaces initiates an Ajax-Push event which updates the Bookings portlet with travel plans of the selected customer:

But wait! There's more -- the IPC is bi-directional in the sense that if I change the first name or last name in the Bookings portlet, then the name will be updated in the Customers portlet too, all thanks to ICEfaces Ajax Push.

See you at JSFOne!


Mostrando 21 - 40 de 44 resultados.
Items 20
de 3