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 Faces Context 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 | JSF |
|
|
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: input Text, h: command Button 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 | 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: action Listener>.
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.