Latest Questions
Post Top Ad
Your Ad Spot
Monday, June 17, 2019

15 Top JSF Interview Questions and Answers {Updated}

JSF Interview Questions and Answers for experienced PDF, Read commonly asked JSF Job Interview Questions with Answers PDF for Freshers.

Read JSF Interview Questions and Answers

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 the traditional request-driven MVC framework, it uses a component-based approach.

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 as other Java technology-based web application, it runs in a JAVA servlet container and it contains
  • JavaBeans components as models consisting of 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

Explain the life cycle of JSF?
The life cycle of JSF includes
  • Restore view phase: During this phase binding of components to its event handlers and validators are executed and the 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 relate 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

List out the available implementations of JavaServer Faces?
When it comes to JSF there is Reference Implementation (RI) by Sun Microsystems; Apache MyFaces is an open source JavaServer Faces (JSF) implementation and for Oracle, there are ADF Faces.

Mention what does a typical JSF application consist of?
The typical JSF application consists 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

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 is compiled within the server
  • JSP is not managed or processed by the faces servlet.  Instead, JSP is 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 the 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

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

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.

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 the server and receive data from server simultaneously. Using Ajax, javascript code exchanges data with the server, update 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.

Mention what is the difference between JSF and Struts?
JSF Struts
  • JSF is a specification
  • JSF action methods can be applied in Java objects
  • JSF has an 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 are no dependencies injection in struts

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>.

What are converter tags in JSF?
JSF has inbuilt converters 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.

List out the converter tags used in JSF?
Converter tags used in JSF are
  • convertNumber: It converts a string into a number of the desired format
  • convertDateTime: It converts a string into a date of the desired format
  • Custom Converter: It creates a custom converter

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

Post Top Ad

Your Ad Spot