JSF Interview Questions & Answers


Q: – What is JSF (or JavaServer Faces)?

A server side user interface component framework for Java™ technology-based web applications.JavaServer Faces (JSF) is an industry standard and a framework for building component-based user interfaces for web applications.JSF contains an API for representing UI components and managing their state; handling events, server-side validation, and data conversion; defining page navigation; supporting internationalization and accessibility; and providing extensibility for all these features.

Q: – What are the available implementations of JavaServer Faces?

The main implementations of JavaServer Faces are:

  • Reference Implementation (RI) by Sun Microsystems.
  • Apache MyFaces is an open source JavaServer Faces (JSF) implementation or run-time.
  • ADF Faces is Oracle’s implementation for the JSF standard.

Q: -What typical JSF application consists of?

A typical JSF application consists of the following parts:

  • JavaBeans components for managing application state and behavior.
  • Event-driven development (via listeners as in traditional GUI development).
  • Pages that represent MVC-style views; pages reference view roots via the JSF component tree.

Q: – What is Managed Bean?

JavaBean objects managed by a JSF implementation are called managed beans. A managed bean describes how a bean is created and managed. It has nothing to do with the bean's functionalities.

Q: – What is view object?

A view object is a model object used specifically in the presentation tier. It contains the data that must display in the view layer and the logic to validate user input, handle events, and interact with the business-logic tier. The backing bean is the view object in a JSF-based application. Backing bean and view object are interchangeable terms.

Q: – Will JSF replace Struts?

Since JSF is focused on user interface components and the view layer, it overlaps with Struts' functionality but doesn't replace it. For existing and future projects, you can either use Struts and JSF together, use only Struts (especially if you already have a mature application), or use JSF by itself. Struts has quite a few features, like Tiles, the Validator framework, application modules, and so on, that make it quite compelling. However, for simpler applications, JSF has enough support for controllers and navigation to make it quite useful by itself. In general, JSF alone is suitable for smaller applications. For more complicated applications, it may make sense to use JSF with a more powerful back-end framework, like Struts. If you're maintaining an existing project, you have a choice of either integrating with JSF (which is logical if you have a lot of GUI components), or just sticking with Struts.

Q: – What are The main tags in JSF?

JSF application typically uses JSP pages to represent views. JSF provides useful special tags to enhance these views. Each tag gives rise to an associated component. JSF (Sun Implementation) provides 43 tags in two standard JSF tag libraries:

JSF Core Tags Library.
JSF Html Tags Library.

Q: – What if no navigation rule matches a given action?

If no navigation rule matches a given action, then the current page is redisplayed.

Q: – What are the JSF life-cycle phases?

The six phases of the JSF application lifecycle are as follows (note the event processing at each phase):

1. Restore view
2. Apply request values; process events
3. Process validations; process events
4. Update model values; process events
5. Invoke application; process events
6. Render response

Submitted By:-Rocky Rana           Email-ID: – rockurana94@yahoo.com