JSF Portlets with Liferay Faces

04-liferay-faces-logo.png

Do you want to develop MVC-based portlets using the Java EE standard? Do you want to use a portlet development framework with a UI component model that makes it easy to develop sophisticated, rich UIs? Or have you been writing web apps using JSF that you’d like to use in Liferay Portal? If you answered yes to any of these questions, you’re in luck! Liferay Faces provides all of these capabilities and more.

Liferay Faces is an umbrella project that provides support for the JavaServer™ Faces (JSF) standard within Liferay Portal. It encompasses the following projects:

  • Liferay Faces Bridge enables you to deploy JSF web apps as portlets without writing portlet-specific Java code. It also contains innovative features that make it possible to leverage the power of JSF 2.x inside a portlet application. Liferay Faces Bridge implements the JSR 329 Portlet Bridge Standard.
  • Liferay Faces Alloy enables you to use AlloyUI components in a way that is consistent with JSF development.
  • Liferay Faces Portal enables you to leverage Liferay-specific utilities and UI components in JSF portlets.

If you’re new to JSF, you probably want to know its strengths, its weaknesses, and how it stacks up to developing portlets with CSS/JavaScript. We’ll give you information on JSF and Liferay Faces to help you decide what framework is best for your needs.

Here are some good reasons to use JSF and Liferay Faces:

  • JSF is the Java EE standard for developing web applications that utilize the Model/View/Controller (MVC) design pattern. As a standard, the specification is actively maintained by the Java Community Process (JCP), and the Oracle reference implementation (Mojarra) has frequent releases. Software Architects often choose standards like JSF because they are supported by Java EE application server vendors and have a guaranteed service-life according to Service Level Agreements (SLAs).
  • JSF was first introduced in 2003 and is therefore a mature technology for developing web applications that are (arguably) simpler and easier to maintain.
  • JSF Portlet Bridges (like Liferay Faces Bridge) are also standardized by the JCP and make it possible to deploy JSF web applications as portlets without writing portlet-specific Java code.
  • Support for JSF (via Liferay Faces) is included with Liferay EE support.
  • JSF is a unique framework in that it provides a UI component model that makes it easy to develop sophisticated, rich user interfaces.
  • JSF has built-in Ajax functionality that provides automatic updates to the browser by replacing elements in the DOM.
  • JSF is designed with many extension points that make a variety of integrations possible.
  • There are several JSF component suites available including Liferay Faces Alloy, ICEfaces, Primefaces, and RichFaces. Each of these component suites fortify JSF with a variety of UI components and complimentary technologies such as Ajax Push.
  • JSF is a good choice for server-side developers that need to build web user interfaces. This enables server-side developers to focus on their core competencies rather than being experts in HTML/CSS/JavaScript.
  • JSF provides the Facelets templating engine which makes it possible to create reusable UI components that are encapsulated as markup.
  • JSF provides good integration with HTML5 markup
  • JSF provides the Faces Flows feature which makes it easy for developers to create wizard-like applications that flow from view-to-view.
  • JSF has good integration with dependency injection frameworks such as CDI and Spring that make it easy for developers to create beans that are placed within a scope managed by a container: @RequestScoped, @ViewScoped, @SessionScoped, @FlowScoped
  • Since JSF is a stateful technology, the framework encapsulates the complexities of managing application state so that the developer doesn’t have to write state management code. It is also possible to use JSF in a stateless manner, but some of the features of application state management become effectively disabled.

There are some reasons not to use JSF. For example, if you are a front-end developer who makes heavy use of HTML/CSS/JavaScript, you might find that JSF UI components render HTML in a manner that gives you less control over the overall HTML document. So, sticking with JavaScript and leveraging AlloyUI may be better for you. Or, perhaps standards aren’t a major consideration for you or you may simply prefer developing portlets using your current framework.

Whether you develop your next portlet application with JSF and Liferay Faces or with HTML/CSS/JavaScript is entirely up to you. But you probably want to learn more about Liferay Faces and try it out for yourself. In the Liferay Faces tutorials, you’ll learn how the Liferay Faces Bridge works, examine using Liferay UI Components and Utilities in JSF applications, leverage AlloyUI components using Liferay Faces Alloy, migrate an existing project to Liferay Faces, and build Liferay Faces from source.

Creating and Deploying JSF Portlets

Liferay supports developing and deploying JSF portlets on Liferay Portal by using Liferay Faces Bridge. The bridge supports deploying JSF web applications as portlets on any JSR 286 (Portlet 2.0)...

Read More

Understanding Liferay Faces Bridge

The Liferay Faces Bridge enables you to deploy JSF web apps as portlets without writing portlet-specific code. It also contains innovative features that make it possible to leverage the power of...

Read More

Understanding Liferay Faces Portal

Liferay Faces Portal is distributed in a .jar file. You can add Liferay Faces Portal as a dependency for your portlet projects, in order to use its Liferay-specific utilities and UI components....

Read More

Understanding Liferay Faces Alloy

Liferay Faces Alloy is distributed in a .jar file. You can add Liferay Faces Alloy as a dependency to your portlet projects, in order to use AlloyUI in a way that is consistent with JSF...

Read More

Understanding the Liferay Faces Version Scheme

In this tutorial, you’ll explore the Liferay Faces versioning scheme, and what each component of a version means. For Liferay Portal 6.2, there are two supported version schemes. The first “older”...

Read More

Specifying the portlet.xml File for Your JSF Portlet

Each portlet project must have a WEB-INF/portlet.xml deployment descriptor file. When creating a JSF portlet using Liferay IDE or the Plugins SDK, this file is created for you. JSF portlets require...

Read More

Using Portlet Preferences with JSF

JSF portlet developers often must enable the end-user to personalize portlets in some way. To meet this requirement, the Portlet 2.0 specification lets you define portlet preferences for each...

Read More

Giving Feedback to Users with Validation Messages

For this tutorial, you’ll learn about giving feedback to your users with validation messages, and how easy JSF makes this process. Liferay Faces Bridge automatically applies the JSR 286 standard...

Read More

Accessing the Portlet API with ExternalContext for JSF Portlets

Just as JSF web app developers rely on ExternalContext to access the Servlet API, JSF portlet developers rely on it to access the Portlet API. As you develop JSF portlets, you’ll often need to...

Read More

Localizing JSF Portlets

In this tutorial, you’ll learn how to internationalize your JSF portlet. If you’re unfamiliar with the term localization, you can learn the basics about it here. There are at least two ways to...

Read More

Communicating Between JSF Portlets Using IPC

Liferay Faces Bridge supports Portlet 2.0 Inter Portlet Communication (IPC), using the JSR 329 approach for supporting Portlet 2.0 Events and Portlet 2.0 Public Render Parameters. You can visit the...

Read More

Contexts and Dependency Injection for JSF Portlets

In December 2009, JSR 299 introduced the Contexts and Dependency Injection (CDI) 1.0 standard into the Java EE 6 platform. In April 2013, JSR 346 updated CDI to version 1.1 for Java EE 7. In...

Read More

Using the LiferayFacesContext with Liferay Faces Portal

LiferayFacesContext is an abstract class in Liferay Faces Portal that extends the JSF FacesContext abstract class. Because of this, it supplies all the same method signatures. The...

Read More

Leveraging the Current Theme with Liferay Faces Portal

Liferay Faces Portal provides access to the Liferay ThemeDisplay object and the current theme’s images. Liferay Faces Portal provides the LiferayFacesContext.getThemeDisplay method for accessing...

Read More

Leveraging the Portal User’s Locale with Liferay Faces Portal

By default, the Locale that is normally used to present internationalized JSF views is based on the web-browser’s locale settings. In order to use the portal user’s language preference, Liferay...

Read More

Dynamically Adding JSF Portlets to Liferay Portal

For this tutorial, you’ll learn how to dynamically add portlets to Liferay Portal pages. Here are the places in which you can add a portlet: Inside the FreeMarker template or Velocity template of a...

Read More

Using PreDestroy and BridgePreDestroy Annotations with Liferay Faces Bridge

For this tutorial, you’ll learn about thePreDestroy and BridgePreDestroy annotations and how to use them. When JSF developers want to perform cleanup on managed-beans before theyre destroyed, they...

Read More

Extending Liferay Faces Bridge Using Factory Wrappers

In this tutorial, you’ll explore how to extend the Liferay Faces Bridge using factory wrappers. Liferay Faces Bridge has several abstract classes that serve as contracts for defining factories:...

Read More

Troubleshooting JSF Portlet Deployment Errors

Many of us have experienced it; you go to deploy a new application into your portal instance and see the dreaded deployment error messages. What do you do? Is the error message helpful? How can I...

Read More

Migrating from Liferay Faces 3.1 to Liferay Faces 3.2/4.2

Liferay Faces 3.2 and 4.2 are compatible with Liferay Portal 6.2 (see the Liferay Faces Version Scheme for more info on Liferay Portal compatibility). Migrating to Liferay Faces 3.2/4.2 from...

Read More

Migrating From PortletFaces to Liferay Faces

The Liferay Faces project originated from the http://portletfaces.org community website. On April 3, 2012 Liferay announced that it would be assuming leadership for the portletfaces.org community....

Read More

Building Liferay Faces From Source

You may have several reasons for downloading and building Liferay Faces from its project source code: To try out the latest cutting edge changes To investigate a suspected bug To learn how Liferay...

Read More
0 (0 Votes)
Using Portlet Namespacing Previous