JSF Structure

This section describes the structure of JSF applications.

JSF – Error Message Snapshot

String errMsg=webMessagesBundle.getString(“xyz");
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, errMsg,errMsg);
// Get the properties file
import java.util.ResourceBundle;
protected static ResourceBundle webMessagesBundle = ResourceBundle.getBundle(“xyz.web.properties.webMessages");
getFacesContext().addMessage("Validation Error",message);

JSF – Structure

The template (most commonly jsp) defines the interface The faces-config defines the navigation and the backing beans Backing beans handle action processing, navigation processing, and connections to the logic (business) layer  

JSF – Web Templates

JSP files most of the time are heavily reliant on tag libraries (taglibs) Core (f) – basic page definition tags

<%@taglib uri="http://java.sun.com/jstl/core" prefix="c"%>

Html (h) – defines standard html tags

<span lang="PT-BR">&lt;%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%&gt;</span>

Html extended (hx) – defines enhanced faces components

<span lang="PT-BR">&lt;%@taglib uri="http://www.ibm.com/jsf/html_extended"</span><span lang="PT-BR"> prefix="hx"%&gt;</span>

Large use of EL (expression language)

Use content area on template for display the web pages.

JSF – Web Template Snapshot

Select Web Page Template

JSF – How to Apply Template on JSF page

Create error template and apply on page