TOP 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 traditional request driven MVC framework it uses component based approach.
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
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
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.
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
How JSF is different from conventional JSP?
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.