Sample Portlet Applications

Table of Contents

Sample Portlet Applications

As of ICEfaces 3.4, the default portlet bridge for the sample applications has changed from PortletFaces Bridge to LiferayFaces Bridge. While the documentation remains mostly the same, the properties and profiles you specify to indicate which bridge to use impacts the documentation as follows:

  • Up to ICEfaces 3.3: The Ant and Maven builds default to using the older PortletFaces Bridge.
    • To specify LiferayFaces for Ant builds, use the -Dliferayfaces="true" property.
    • To specify LiferayFaces for Maven builds, use the -Pliferayfaces profile.
  • ICEfaces 3.4 and beyond: The Ant and Maven builds default to using the latest LiferayFaces Bridge.
    • To specify PortletFaces for Ant builds, use the -Dportletfaces="true" property.
    • To specify LiferayFaces for Maven builds, use the -Pportletfaces profile.

Portlet Bridges

ICEfaces supports two different portlet bridges for running ICEfaces portlets. Be sure to review the section on the supported bridges in the Portlet Bridges section.

Sample Portlets

The following sample portlets are included in the ICEfaces distribution.  The examples are useful for getting a quick start on how to build a portlet using ICEfaces and the PortletFaces Bridge.  This includes what the markup should look like, what files need to be included, and how they should be configured. For each portlet example, there is a corresponding non-portlet example. Looking under the [icefaces.dir]/samples, you'll find:

Showcase

The Showcase portlets are examples based on the ICEfaces Showcase example configured to run in a portal. It uses the same markup and code as the non-portlet demo, but with each component example delivered as an individual portlet. The sample is located under:

[icefaces.install.dir]/icefaces/samples/showcase/showcase-portlet

Chat

The Chat example is a demonstration portlet that uses only stock JSF components and ICEpush. You can drop multiple instances on a single portal page and chat between the instances as well as between different browsers. The sample code is located under:

[icefaces.install.dir]/icefaces/samples/core/chat-portlet

Building

Each portlet example is built by using the content from the corresponding non-portlet parent project and adding in the portlet-specific files required. To build a portlet .war file for Liferay 6 running on Tomcat 6.0, follow the instructions for your appropriate build tool (Ant or Maven):

Building with Ant

From your terminal or console, navigate to the example you wish to build and then execute the appropriate command. For example, to build the showcase, navigate to the showcase-portlet directory and type:

[icefaces.install.dir]/icefaces/samples/showcase/showcase-portlet > ant clean liferay6.servlet-profile

Because of licensing restrictions, the LiferayFaces Bridge libraries are not shipped with ICEfaces so you need to:

  1. Download the bridge libraries from the Liferay Faces site.
  2. Copy the libraries into a folder under [icefaces.install.dir]/icefaces/lib/portlets/liferayfaces.
  3. Run the ant command.

To do a build with Ant and include the PortletFaces Bridge, you use the same command but set the appropriate property:

[icefaces.install.dir]/icefaces/samples/core/chat-portlet > ant -Dportletfaces="true" clean liferay6.servlet-profile

In both cases, the resulting .war file is located under the build/dist directory:

[icefaces.install.dir]/samples/showcase/showcase-portlet/build/dist/showcase-portlet.war

Building with Maven

From your terminal or console, navigate to the example you wish to build and then execute the appropriate command. For example, to build the showcase, navigate to the showcase-portlet directory and type:

[icefaces.install.dir]/icefaces/samples/showcase/showcase-portlet > mvn clean package

The default Maven profile builds the war using the latest LiferayFaces Bridge. The latest version is specified in the top-level pom of the icefaces distrubution:

[icefaces.install.dir]/icefaces/pom.xml

If you need a version other than the one specified in that file, change the following property to the version you require:

<liferayfaces.version>3.1.2-ga3-SNAPSHOT</liferayfaces.version>

To do a build with Maven and include the PortletFaces Bridge, you will need to specify the appropriate profile:

[icefaces.install.dir]/icefaces/samples/showcase/showcase-portlet > mvn clean package -Pportletfaces

The resulting .war file is located under the relative target directory:

[icefaces.install.dir]/samples/showcase/showcase-portlet/target/showcase-portlet.war

Deploying

The resulting .war file from either build can be deployed directly to the Liferay deploy directory. Once deployed, it will show up in the list of available portlets under the ICEfaces category.

Mojarra vs MyFaces

All of the ICEfaces portlet sample applications default to using Mojarra as the JSF implementation. You can choose MyFaces by using the appropriate property or profile depending on which build system you use:

Ant: Turn on the MyFaces property when building:

[icefaces.install.dir]/icefaces/samples/core/chat-portlet > ant -Dmyfaces="true" clean liferay6.servlet-profile

Maven: Use the MyFaces servlet profile:

[icefaces.install.dir]/icefaces/samples/showcase/showcase-portlet > mvn clean package -P servlet-myfaces
MyFaces Modification

Currently, each portlet sample app contains listener configurations to handle a known issue with Mojarra and the LiferayFaces Bridge. See http://issues.liferay.com/browse/FACES-1511 for more details. If you decide to run with MyFaces, the following listeners must be removed from the web.xml file:

<listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>

<listener>
    <listener-class>com.liferay.faces.bridge.servlet.BridgeSessionListener</listener-class>
</listener>
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

© Copyright 2018 ICEsoft Technologies Canada Corp.