If you’re unfamiliar with the Liferay Faces project, it’s important to know that Liferay Faces is an umbrella project that provides support for the JavaServer Faces (JSF) standard in Liferay Portal. Thus, Liferay Faces portlets and JSF portlets are closely related. Visit the JSF-related learning path for further details on JSF portlets and the Liferay Faces project.
This tutorial explains the Liferay Faces portlets generation process using Maven, and the anatomy of a JSF portlet.
You’ll begin creating a Liferay Faces portlet plugin next.
Creating a Liferay Faces Portlet Plugin
To create your Liferay Faces portlet plugin project, follow the Creating Liferay Maven Plugins from Liferay IDE tutorial or the Creating Liferay Maven Plugins from the Command Line tutorial, making sure to select Portlet as the plugin type and JSF 2.x as the portlet framework. Lastly, you’ll be required to select a JSF component suite.
A Liferay Faces portlet can be built to use one of several different JSF component suites, including RichFaces, PrimeFaces, Liferay Faces Alloy, the JSF Standard suite, and ICEfaces. Each JSF component suite has an archetype that is used in creating the portlet.
It’s helpful to familiarize yourself with a Liferay Faces portlet plugin project’s directory structure. You can explore its anatomy next.
A portlet project created from the
com.liferay.maven.archetypes:liferay-portlet-jsf-archetype has the following
Maven creates the
src/main/java/ directory automatically. It holds the
portlet’s Java source code (e.g.,
portlet-plugin/src/main/webapp holds its web source code. If you’ve created
any portlet plugins using the Plugins SDK, you might have noted it uses a
different directory structure.
The following table illustrates the differences in the locations of the Java source code and web source code for a Maven project and a Plugins SDK project:
Location | Maven project | Plugins SDK project |
———– | —————– | ——————— |
Java source |
Web source |
Congratulations! You now know how to create Liferay Faces portlets that can leverage one of several powerful JSF frameworks.
JSF Portlets with Liferay Faces
Developing Liferay Plugins with Additional Maven Archetypes