Blog Archive

Theme images by Storman. Powered by Blogger.

Wednesday, August 31, 2016

Most Tricky JSF Interview Questions For Freshers And Experienced.


Most Tricky JSF Interview Questions For Freshers And Experienced. Common JSF Interview Questions And Answers Freshers. Top 14 JSF Interview Questions With Answers.

1) Explain what is JSF or Java Server Faces?

Java Server Faces or JSF : It is a java based web application framework to make the user interface simple for JEE applications.  Instead of traditional request driven MVC framework it uses component based approach.

2) Explain what is the JSF architecture?

JSF is designed on the MVC (Model-View-Controller) framework and this allows for applications to be scaled better. A JSF application is same like other Java technology based web application, it runs in a JAVA servlet container and it contains

JavaBeans components as models consisting data and application-based functionality
Custom tag library for representing validators and event handlers
Custom tag library for rendering UI components
UI components signified as stateful objects on the server
Server side helper classes
Event handlers, validators and navigation handlers
Application configuration resource file for organizing and configuring application resources
3) Explain the life cycle of JSF?

Life cycle of JSF includes

Restore view phase: During this phase binding of components to its event handlers and validators are executed and view is saved in the FacesContext object
Apply request values phase: The motive of this phase is to retrieve its current date for each component
Process validation phase: During this phase, local values saved for the component in the tree are compared to the components validation rules registered
Update model value phase: After verifying, that data is genuine or valid in the previous phase, local values of components can be set to related server side object properties
Invoke application phase: Prior to this phase the component values have been transformed, validated and applied to the bean objects, so that you can avail them to run the application’s business logic
Render response phase: JSP container renders the page back to the user in this phase
4) List out the available implementations of JavaServer faces?

When it comes to JSF there are Reference Implementation (RI) by Sun Microsytems; Apache MyFaces is an open source JavaServer Faces (JSF) implementation and for Oracle there is ADF Faces.

5) Mention what does a typical JSF application consist of?

The typical JSF application consist of

JSF JavaBeans components for managing the application state and its behavior
Event driven development
Pages that represent MVC style views, pages reference view roots via the JSF component tree

6) Explain how JSF is different from conventional JSP?


JSP is a Java based technology used in order to help developers to create dynamic web pages
JSP must be compiled in JAVA byte-code in respect to function properly
JSP does not support validator and conversion, ajax etc.
JSP is not an interface within the view template. However, JSP are compiled within the server
JSP is not managed or processed by the faces servlet.  Instead, JSP are Java Servlets by themselves


JSF is a web application used to simplify development integration of web based user interfaces
JSF contains multiple core features like managed beans, component system etc. that is based on template, and tag libraries
JSF supports validator and conversion, ajax etc.
Within a view template JSF is an interface
JSF is processed by Faces Servlet

7) Explain what is rendering of page in JSF?

A JSF page has components which are made with the help of JSF library. The JSF components like h:form, h:inputText, h:commandButton etc. are rendered or translated to HTML output.  This process is referred as encoding.  Encoding assigns a unique id to a component by the framework and the ids are produced at random.

8) Mention what does JSF-Managed Bean?

Managed bean in JSF act as a Model for UI component, it can be accessed from JSF page.  The managed bean consists of the “getter” and “setter” techniques, business logic or even a backing bean.

9) Explain what Ajax is and how JSF is useful for making AJAX call?

Ajax is a method to use HTTPXMLObject of JavaScript to direct data to server and receive data from server simultaneously. Using Ajax, javascript code exchanges data with server, updates parts of webpages without reloading the whole page. For making Ajax call JSF provides full support. It provides f:ajax tag to handle ajax calls.

10) Mention what is the difference between JSF and Struts?


JSF is a specification
JSF action methods can be applied in Java objects
JSF has event model which reacts on actions, value changes and phase changes in JSF lifecycle
JSF component tag does not produce HTML-instead they declare a component renderer pair on the server
By mentioning a navigation rule in the faces configuration file, JSF supports navigation
JSF uses dependencies injection


Struts is an open source framework
Struts actions are restricted to struts API only
There are no such event models in struts
Struts tag generates HTML directly
To define navigation struts uses the notation
There is no dependencies injection in struts
11) Explain how you can call multiple listeners in JSF?

To call multiple listeners in JSF, there is a JSF tag for “value change listeners” and one for “action listeners” that can be availed to link one or more than one listeners to an element.  While using the tag syntax, you will be declaring a class that implements a listener interface.  For value change listener tag is <f:valueChangeListener> and for action listeners tag is <f:actionListener>.

12) What are converter tags in JSF?

JSF has inbuilt convertors to convert or change its UI components data to object used in a managed bean and vice versa. These tags can convert text into date object and can validate the format of the input as well.

13) List out the converter tags used in JSF?

Converter tags used in JSF are

convertNumber: It converts a string into a number of desired format
convertDateTime: It converts a string into a date of desired format
Custom Converter: It creates a custom converter

14) Explain what are facelets JSF tags?

Facelets JSF tags are special tags to create common layout for a web application referred as facelet tags. To manage common parts of a multiple pages at one place, facelets tags are used.

0 on: "Most Tricky JSF Interview Questions For Freshers And Experienced. "