Logo F2FInterview

JSF Interview Questions

Q   |   QA

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:

/login.jsp

login
/main.jsp

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

user
core.jsf.LoginBean
session

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.

In order to link this F2FInterview's page as Reference on your website or Blog, click on below text area and pres (CTRL-C) to copy the code in clipboard or right click then copy the following lines after that paste into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code: