JSF implementation automatically converts component data between presentation view and model when the bean property associated with the component is of one of the types supported by the component’s data.
For example, If a UISelectBoolean component is associated with a bean property of type Boolean, then JSF implementation will automatically convert the data from String to Boolean.
Component classes generally transfer the task of generating output to the renderer. All JSF components follow it. Render kit is a set of related renderers. javax.faces.render.RenderKit is the class which represents the render kit. The default render kit contains renderers for html but it’s up to you to make it for other markup languages. Render kit can implement a skin (a look & feel). Render kit can target a specific device like phone, PC or markup language like HTML, WML, SVG. This is one of the best benefit of JSF because JSF doesn’t limit to any device or markup.
The Navigation rules indicate the JSF implementation to decide which page to navigate to after a certain action has been done on the browser like a form submission, etc.
The following example shows the usage of the navigation rules:
from-outcome should match with action attribute of the command button of the login.jsp:
Secondly, it should also match with the navigation rule in face-config.xml as
In the UI component, to be declared / used as:
JSF libraries need to be added in an application. On the .jsp page, a tag library needs to be added:
<%@ taglib uri=”http://java.sun.com/jsf/core” prefix=”f”%> <%@ taglib uri=”http://java.sun.com/jsf/html” prefix=”h”%>
In an XML style:
The JSF components can be accessed using the prefix attached.
In an IDE, JSF can be added easily. However, when working without them the faces-config.xml needs to be updated and populated with classes i.e. Managed Beans between the following tags
Every JSF page as described has various components made with the help of JSF library. JSF may contain h:form, h:inputText, h:commandButton, etc. Each of these is rendered (translated) to HTML output. This process is called encoding. The encoding procedure also assigns each component with a unique ID assigned by framework. The ID generated is random.