JSF Portlet Introduction
JSF Portlet Introduction
Objective
The goal of this tutorial is to create a Java Server Faces (JSF) Portlet within Liferay
1. What is JSF? 2. Why JSF vs. Struts?
Key Concepts
What are the main differences between a JSF Portlet and a JSP Portlet?
JSF follows the MVC pattern, and provides a framework to develop robust web applications JSP is a model 1 pattern; good for rapid prototyping
What is JSF?
JavaServer Faces technology is a framework for building user interfaces for web applications. JavaServer Faces technology includes: A set of APIs for: representing UI components and managing their state, handling events and input validation, defining page navigation, and supporting internationalization and accessibility. A JavaServer Pages (JSP) custom tag library for expressing a JavaServer Faces interface within a JSP page.
Reference: Sun Developer Network. JavaServer Faces Technology FAQ. http://java.sun.com/javaee/javaserverfaces/reference/faqs/index.html
Highly Customizable
Every level of the JSF life cycle is customizable. For example, JSF is not tied to a presentation layer and does not have to use the HTTP protocol.
JavaServer Faces separates the definition of a component from its rendering, so you can render your components in different ways or even to different clients, such as a WML client. JavaServer Faces technology allows you to extend the standard set of components and create entirely new components. Struts has no notion of server-side components, which means that it has no event model for responding to component events and no facility for saving and restoring component state. While Struts does have a useful tag library for rendering components on the page, these components have no object representation on the server and they can only be rendered to an HTML client. The controller logic is implemented in POJOs so there is no need to implement Struts processAction or execute methods. JSF provides tags that specify which method will be called, further simplifying the controller logic. <h:commandButton action="#{myBean.addBook}"> calls myBean.addBook()
Reference: Sun Developer Network. JavaServer Faces Technology FAQ. http://java.sun.com/javaee/javaserverfaces/reference/faqs/index.html
Revision History
Edward Shin James Min 8/28/2006 Updated for Liferay 4.1.1 01/17/2007 4.2.1