1) What is JSF?
JSF stands for Java Server Faces is a Java-Based web application framework.
JSF (Java Server Faces) provides a facility to connect UI widgets with data sources.
2) What are the benefits of JSF?
Benefits of JSF are:
- Reusable UI components
- Easy data transfer between UI components
- Enable implementation of custom components
- Manage UI state across multiple server requests
3) What is MVC Design Pattern?
It is used to design an application using three separate modules.
Modules are:
4) What are the phases of JSF life cycle?
Phases of JSF life cycle are:
- Restore view phase
- Apply request values phase
- Process validations phase
- Update model values phase
- Invoke application phase
- Render response phase
5) What are the types of Converter Tags used in JSF?
There are three types of converter tags used in JSF are:
- f:convertNumber
- f:convertDateTime
- Custom Convertor
6) What are the types of Validator Tags used in JSF?
Types of Validator tags are:
- f:validateLength
- f:validateLongRange
- f:validateDoubleRange
- f:validateRegex
- Custom Validator
7) What are the types of Event Handlers used in JSF?
There are three types of Event Handlers in JSF:
- actionListener
- Application Events
- valueChangeListener
8) What are the advantages of JSF Expression language?
Advantages of JSF Expression language are:
- It provides easy access to elements
- It provides Automatic type conversion
- It provides easy access to predefined objects
- Instead of NullPointerException, It shows missing values as empty strings
- By using expression language(Arithmetic, relational and logical operations can be done)
9) What is Managed Bean in JSF?
It is a Java Bean class registered with JSF.
Here, Java bean class are managed by JSF framework.
It works as Model for UI component and accessed from JSF page.
10) What is h:inputSecret tag in JSF?
h:inputSecret tag:
It is used to create a HTML password fields.
It accepts one line of text with no spaces.
11) What is the difference between JSF and Struts?
Difference between JSF and Struts are:
JSF |
Struts |
It is a specification |
It is an open source framework |
Here, Action methods can be applied in Java objects |
Here, Struts actions are restricted to struts API only |
Here, Component tag does not produce HTML |
Here, Struts tag generates HTML directly |
It supports navigation |
Struts uses the notation to define navigation |
Uses dependencies injection |
Not uses dependencies injection |
12) Which tag is used to display error messages in JSF?
By using
h:messages tag, you can display error messages in JSF.
13) What is the difference between JSF-1 and JSF-2?
Difference between JSF-1 and JSF-2 are:
JSF-1 |
JSF-2 |
It does not support annotations |
It supports annotations |
Here, Ajax support was limited |
It supports all the Ajax features |
Does not provide Template concepts |
Provide Template concepts |
14) What are the important basic tags used in JSF?
Important basic tags used in JSF are:
h:inputText |
h:inputSecret |
h:selectOneMenu |
h:commandLink |
h:inputTextarea |
h:inputHidden |
h:outputStylesheet |
h:outputLink |
h:selectBooleanCheckbox |
h:selectManyCheckbox |
h:outputScript |
h:panelGrid |
h:selectOneRadio |
h:outputText |
h:commandButton |
h:message |
h:selectOneListbox |
h:outputFormat |
h:Link |
h:messages |
h:selectManyListbox |
h:graphicImage |
f:attribute |
f:attribute |
15) h:inputSecret field becomes empty when page is reloaded. How to fix this?
Set redisplay=true (By default it is false).
16) What is the use of @ManagedProperty annotation in JSF?
@ManagedProperty annotation: This property is used to transfer or inject a managed bean's property in another managed bean.
17) What is eager?
eager: It is an attribute that is used to create managed bean.
If eager = "true", then managed bean is created before it is requested for the first time.
18) What is lazy initialization in JSF?
lazy initialization: It is used to create managed bean but only when it is requested.
19) Can we access Managed Bean from JSF Page?
Yes, We can access Managed Bean from JSF Page.
20) What are the Scope Annotations available in JSF?
The Scope Annotations available in JSF are:
- @NoneScoped
- @ViewScoped
- @CustomScoped
- @SessionScoped
- @RequestScoped
- @ApplicationScoped
21) What is Implicit Navigation?
Implicit Navigation: It is an
auto view page resolver mechanism which is provided by JSF.
In
Implicit Navigation, you only need to put view name in action attribute and JSF will search the correct view page automatically in the deployed application.
22) What is the use of f:attribute in JSF?
f:attribute: This tag is used to pass attribute to a JSF UI Component.
23) What is the use of f:param in JSF?
f:param: This tag is used to pass parameters to a JSF UI Component.
24) What is facelets tag?
facelets tag: This is a special tag that is used to create common layout for a web application.
Facelets tag provides flexibility to manage common parts of multiple pages at one place.
25) What is the use of Convertor Tags in JSF?
Convertor Tags: These tags are used to convert JSF UI component’s data to object in a managed bean.
For example, Convertor tags are used to convert a text into date object and can validate the format of input as well.
26) What is DataTable in JSF?
DataTable: It is used to iterate over a collection or array of values to display data.
DataTable also provides attributes to modify its data in an easy way.
27) What are the Composite Tags available in JSF?
The Composite Tags available in JSF are:
- composite:interface
- composite:attribute
- composite:implementation
28) What is DelegatingVariableResolver in JSF?
DelegatingVariableResolver: It is a class which is used to integrate JSF and Spring together in a seamless manner.
29) What is the use of composite:attribute tag in JSF?
composite:attribute: This tag is used to declare Configuration values.
30) What is h:inputTextarea tag in JSF?
h:inputTextarea: This tag is used to renders an HTML textarea element.