Home / Interview / JSF :: General Questions

Interview :: JSF

1)

What is JSF (JavaServer Faces)?

It is a server-side component-based user interface framework. It is used to develop web applications. It provides a well-defined programming model and consists of rich API and tag libraries. The latest version JSF 2 uses Facelets as its default templating system.

2)

What are the benefits of JSF (JavaServer Faces)?

It provides a clean and clear separation between behavior and presentation of the web application. You can write business logic and user interface separately.

3)

What are the features of JSF (JavaServer Faces)?

The latest version of JSF 2.2 provides the following features.

  • Component-Based Framework
  • Implements Facelets Technology
  • Integration with Expression Language
  • Support HTML5
  • Ease and Rapid Web Development.
  • Support Internationalization
  • Bean Annotations

4)

Give the system requirements for the JSF use?

For using JSF in a computer, the platform needs to have JDK 1.5 or above.

5)

What is the life cycle of JSF (JavaServer Faces)?

JavaServer Faces application framework manages lifecycle phases automatically for simple applications and also allows you to manage that manually. The lifecycle of a JavaServer Faces application begins when the client makes an HTTP request for a page and ends when the server responds with the page.

6)

How does the execution phase work in JSF (JavaServer Faces) life cycle?

In the execute phase, when the first request is made, the application view is built or restored. For other subsequent requests other actions are performed like request parameter values are applied, conversions and validations are performed for component values, managed beans are updated with component values, and application logic is invoked.

7)

How does render phase work in JSF (JavaServer Faces) life cycle?

In this phase, the requested view is rendered as a response to the client browser. View rendering is a process in which output is generated as HTML or XHTML. So, the user can see it on the browser.

8)

What is managed bean in JSF (JavaServer Faces)?

It is a pure Java class which contains a set of properties and the set of the getter, setter methods.

Following are the common functions that managed bean methods perform:

  • Validating a component's data
  • Handling an event fired by a component
  • Performing processing to determine the next page to which the application must navigate

9)

How to configure managed bean in the XML file?

In this case, we configure bean-name, bean-class, and bean-scope in the XML file to make it accessible in the project. This is an older approach to configure bean into an XML file.

10)

What are the available scopes for the managed bean?

You can use following scopes for a bean class:

  • Application (@ApplicationScoped): Application scope persists across interaction of all the users with the web application.
  • Session (@SessionScoped): Session scope persists across multiple HTTP requests in a web application.
  • View (@ViewScoped): View scope persists during the interaction of the user with a single page (view) of a web application.