JSF interview question and answers[Experienced]/JSF Interview Questions and Answers for Freshers & Experienced

Can we integrate JSF with other popular frameworks such as Spring, Hibernate etc?

Yes, we can integrate JSF framework with Spring, Hibernate, JDBC etc. Since JSF is more focused on view components, we can utilize it for user interface and other frameworks as backend server side integration and ORM tools.

Posted Date:- 2021-09-14 07:46:35

Why JSF is not so popular as MVC framework like Spring MVC, even though its older?

Some of the reasons I could thought of are;

There are many implementations of JSF like Mojarra, Primefaces, Richfaces etc which makes it difficult for the user to comprehend learn and adapt to whereas Spring MVC has only one implementation maintained by a Single group of developers which avoids confusion.

Spring has got great integration with data management through standalone or ORM frameworks out of the box which is lacking in JSF based implementation.

DI and IOC design patterns makes it very easy to integrate existing legacy applications with new Spring based applications whereas JSF does not have such kind of capabilities.

JSF is a component based framework whereas Spring is a Request-Response based framework and hence easy to understand and relates closely to MVC, Struts2 and other similar frameworks

Posted Date:- 2021-09-14 07:45:26

What are different implementations of JSF API?

Spring uses Inversion of Control and Dependency Injection whereas JSF does not.

Spring has built in modules for Login-Logout available for ready integration whereas in JSF we have to write the login feature manually.

Since Spring uses dependency injection the user based pojo classes can be injected with springs whereas JSF is tightly coupled with Java EE architecture.

Posted Date:- 2021-09-14 07:44:11

List the benefits of Expression Language?

<> Arithmetic, logical, relational operations can be used in expression language.
<> Automatic type conversion.
<> Shows missing values as empty strings instead of NullPointerException.
<> Provides easy access to predefined objects such as request.

Posted Date:- 2021-09-14 07:43:22

Explain different ways of declaring a managed bean in JSF?

1. Use @ManagedBean annotation in the java class indicating that the class is a managed bean as;
@ManagedBean(name="Greetings", eager="true")If the name attribute is not specified the name is defaulted to the class name as java naming standards. For example class Car will be named “car” and CarDetails will be named “carDetails”.

2. Declare the managed bean in faces-config.xml file as;
<managed-bean> <managed-bean-name>Greetings</managed-bean-name> <managed-bean-class>com.Greetings.Greetings</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean>

Posted Date:- 2021-09-14 07:42:26

What are some of the best practices for JSF application?

The best practices for JSF application includes:

Avoid using JSF components for static value.
Short component Id.
Avoid component bindings.
Facelets for dynamic includes.

Posted Date:- 2021-09-14 07:40:30

How to implement internationalization (i18n) in JSF?

Internationalization is a mechanism in which status messages, GUI component labels, currency, date are stored outside the source code in resource bundles and retrieved dynamically rather than hardcoding in the program based on the user locale.

Posted Date:- 2021-09-14 07:39:35

List the benefits of data table tags in JSF?

DataTable can iterate over collection or array of values to display data.
DataTable provides attributes to modify its data in easy way.

Posted Date:- 2021-09-14 07:38:58

Explain @ViewScoped, @SessionScoped, @CustomScoped and @RequestScoped annotations?

@ViewScoped: annotation indicates that the bean is alive as long as the user interacts with the same JSF view page in the browser.
@SessionScoped: annotation indicates that the bean is valid as long as the HTTP session is alive.
@CustomScoped: annotation indicates that the bean lives as long as the bean’s entry in the custom Map which is created for this scope lives.
@RequestScoped: annotation indicates that the Bean lives as long as the HTTP request-response lives.

Posted Date:- 2021-09-14 07:37:58

What is the significance of facelets tag?

JSF provides a special set of tags that gives the flexibility to manage common tags/parts in one place for more than one application. These tags allow us to create a common layout that can be used across applications. You can include facelets tags using below code;
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" >

Posted Date:- 2021-09-14 07:37:13

What is JSF Navigation Rule?

The rules provided by JSF Framework to describe the view to be shown when a button or link is clicked is called a navigation rule.

Posted Date:- 2021-09-14 07:36:08

What is a listener class?

A class which is associated with an event is called a listener class. For example, if the event is a valueChange event then the corresponding listener class ValueChangeListener is associated with it.

Posted Date:- 2021-09-14 07:34:49

How Does Jsf Depict The Mvc (model View Controller) Model?

The data that is manipulated in form or the other is done by model. The data presented to user in one form or the other is done by view. JSF is connects the view and the model. View can be depicted as shown by:
<h:inputText value="#{user.name}"/>
JSF acts as controller by way of action processing done by the user or triggering of an event. For ex.
<h:commandbutton value="Login" action="login"/>
this button event will triggered by the user on Button press, which will invoke the login Bean as stated in the faces-config.xml file. Hence, it could be summarized as below: User Button Click -> form submission to server ->; invocation of Bean class ->; result thrown by Bean class caught be navigation rule ->; navigation rule based on action directs to specific page.

Posted Date:- 2021-09-14 07:33:30

What Is The Difference Between Jsp And Jsf?

JSP simply provides a Page which may contain markup, embedded Java code,and tags which encapsulate more complicated logic / html. JSF may use JSP as its template, but provides much more. This includes alidation, rich component model and lifecycle, more sophisticated EL, separation of data, navigation handling, different view technologies (instead of JSP), ability to provide more advanced features such as AJAX, etc.

Posted Date:- 2021-09-14 07:32:14

What Is Javaserver Faces Technology?

A framework for building server ­side user interfaces for Web applications written in the Java programming language.

Posted Date:- 2021-09-14 07:31:37

What Is Javaserver Faces Navigation Model?

A mechanism for defining the sequence in which pages in a JavaServer Faces application are displayed.

Posted Date:- 2021-09-14 07:31:06

What Is Javaserver Faces Expression Language?

A simple expression language used by a JavaServer Faces UI component tag attributes to bind the associated component to a bean property or to bind the associated component’s value to a method or an external data source, such as a bean property. Unlike JSP EL expressions, JavaServer Faces EL expressions are evaluated by the JavaServer Faces implementation rather than by the Web container.

Posted Date:- 2021-09-14 07:30:36

What Is Javaserver Faces Conversion Model?

A mechanism for converting between string based markup generated by Java Server Faces UI components and server side Java objects

Posted Date:- 2021-09-14 07:29:24

What Is Javaserver Faces Event And Listener Model?

A mechanism for determining how events emitted by JavaServer Faces UI components are handled. This model is based on the JavaBeans component event and listener model.

Posted Date:- 2021-09-14 07:28:55

How can we obtain the generated event?

The generated event can be obtained by calling event.getComponent as
UIComponent ui = new UIComponent(); MyFacesEvent ev1 = new MyFacesEvent(ui); UIComponent sc1 = ev1.getComponent();

Posted Date:- 2021-09-14 07:26:26

How can we obtain the generated event?

The generated event can be obtained by calling event.getComponent as
UIComponent ui = new UIComponent(); MyFacesEvent ev1 = new MyFacesEvent(ui); UIComponent sc1 = ev1.getComponent();

Posted Date:- 2021-09-14 07:26:26

What Does It Mean By Render Kit In Jsf?

A render kit defines how component classes map to component tags that are appropriate for a particular client. The JavaServer Faces implementation includes a standard HTML render kit for rendering to an HTML client.

Posted Date:- 2021-09-14 07:25:02

Explain Briefly The Life-cycle Phases Of Jsf?

1.Restore View : A request comes through the FacesServlet controller. The controller examines the request and extracts the view ID, which is determined by the name of the JSP page.
2. Apply request values : The purpose of the apply request values phase is for each component to retrieve its current state. The components must first be retrieved or created from the FacesContext object, followed by their values.
3. Process validations : In this phase, each component will have its values validated against the application's validation rules.
4. Update model values: In this phase JSF updates the actual values of the server-side model ,by updating the properties of your backing beans.
5. Invoke application : In this phase the JSF controller invokes the application to handle Form submissions.
6. Render response : In this phase JSF displays the view with all of its components in their current state.

Posted Date:- 2021-09-14 07:24:33

What If No Navigation Rule Matches A Given Action?

If no navigation rule matches a given action, then the current page is redisplayed.

Posted Date:- 2021-09-14 07:21:58

How To Declare The Page Navigation (navigation Rules) In Faces-config.xml File?

Navigation rules tells JSF implementation which page to send back to the browser after a form has been submitted. We can declare the page navigation as follows:
This declaration states that the login action navigates to /welcome.jsp, if it occurred inside /index.jsp.

Posted Date:- 2021-09-14 07:21:32

How Do You Declare The Managed Beans In The Faces-config.xml File?

The bean instance is configured in the faces-config.xml file:
This means: Construct an object of the class com.developersBookJsf.loginBean, give it the name login, and keep it alive for the duration of the request.

Posted Date:- 2021-09-14 07:20:59

What Are The Main Tags In Jsf?

JSF application typically uses JSP pages to represent views. JSF provides useful special tags to enhance these views. Each tag gives rise to an associated component.

JSF (Sun Implementation) provides 43 tags in two standard JSF tag libraries:

•JSF Core Tags Library.
•JSF Html Tags Library.

Posted Date:- 2021-09-14 07:17:53

What Is The Difference Between Jsp-el And Jsf-el?


1. In JSP-EL the value expressions are delimited by ${…}.

2. The ${…} delimiter denotes the immediate evaluation of the expressions, at the time that the application server processes the page.

1. In JSf-EL the value expressions are delimited by #{…}.

2. The #{…} delimiter denotes deferred evaluation. With deferred evaluation ,the application server retains the expression and evaluates it whenever a value is needed.

Posted Date:- 2021-09-14 07:17:09

What Are The Different Kinds Of Bean Scopes In Jsf?

JSF supports three Bean Scopes. viz.,
•Request Scope: The request scope is short-lived. It starts when an HTTP request is submitted and ends when the response is sent back to the client.
•Session Scope: The session scope persists from the time that a session is established until session termination.
•Application Scope: The application scope persists for the entire duration of the web application. This scope is shared among all the requests and sessions.

Posted Date:- 2021-09-14 07:16:22

What are required configurations for JSF framework?

There are two configuration files namely;

>> web.xml: This is the general web application configuration file containing the details of deployment. This contains the faces config file responsible for handling the application.

>> faces-config.xml: allows to configure the application, managed beans, converters, validators, and navigation.

Posted Date:- 2021-09-14 07:15:33

Mention two ways of binding supported by JSF?

Binding the component’s value to a bean property or other external data source
Binding the component’s instance to a bean property

Posted Date:- 2021-09-14 07:14:31

Explain immediate and rendered attributes?

The immediate attribute if set to true can force validations, events and conversions processed during request phase of the lifecycle. Command component’s immediate attribute indicates what happens when the component gets activated. If the button’s immediate attribute is set to true and associated text field’s immediate attribute set to false then the event is processed without applying the field’s value to the model. In other words the value entered in the field does not even reach the model when the button is clicked but immediately processed in the above scenario.

Posted Date:- 2021-09-14 07:14:01

What is the significance of selectOne menu tag in JSF?

The selectOne enables users to select a single value from the list of values. This component can be rendered as a list box, a set of radio buttons or a menu.

Posted Date:- 2021-09-14 07:13:32

What are different implementations of JSF API?

>> ADF Faces: Oracle’s implementation for the JSF standard.
>> Reference Implementation (RI): by Sun Microsystems.
>> Apache MyFaces: open source JavaServer Faces (JSF) implementation.
>> Primefaces: JSF components with Ajax framework.

Posted Date:- 2021-09-14 07:12:53

Explain different types of JSF events?

The different types of JSF events are:
1. Post Construct Application Event:- It fires when the application begins. It is used for performing tasks related to initialization after an application has started.

2. Pre Destroy Application Event:- It fires when an application is about to close. It performs all kinds of clean-up tasks before the application gets closed.

3. PreRender View Event:- It fires when the JSF page is about to get displayed. It is used for user authentication. It gives restricted access to JSF view.

Posted Date:- 2021-09-14 07:11:30

What are different types of expressions supported by JSF EL?

JSF Expression Language supports following types of expressions.

1. Immediate value expressions
2. Deferred value expressions
3. Value expression and method expression

Posted Date:- 2021-09-14 07:09:52

What Do You Mean By Bean Scope?

Bean Scope typically holds beans and other objects that need to be available in the different components of a web application.

Posted Date:- 2021-09-14 07:09:06

What Is The Difference Between The Domain Object Model And A View Object?

In a simple Web application, a domain object model can be used across all tiers, however, in a more complex Web application, a separate view object model needs to be used. Domain object model is about the business object and should belong in the business-logic tier. It contains the business data and business logic associated with the specific business object. A view object contains presentation-specific data and behavior. It contains data and logic specific to the presentation tier.

Posted Date:- 2021-09-14 07:08:42

What Is Domain Object Model?

Domain object model is about the business object and should belong in the business-logic tier. It contains the business data and business logic associated with the specific business object.

Posted Date:- 2021-09-14 07:08:22

What Are The Differences Between A Backing Bean And Managed Bean?

Backing Beans are merely a convention, a subtype of JSF Managed Beans which have a very particular purpose. There is nothing special in a Backing Bean that makes it different from any other managed bean apart from its usage.

Posted Date:- 2021-09-14 07:07:03

What Is Backing Bean?

Backing beans are JavaBeans components associated with UI components used in a page. Backing-bean management separates the definition of UI component objects from objects that perform application-specific processing and hold data.

The backing bean defines properties and handling-logics associated with the UI components used on the page. Each backing-bean property is bound to either a component instance or its value. A backing bean also defines a set of methods that perform functions for the component, such as validating the component's data, handling events that the component fires and performing processing associated with navigation when the component activates.

Posted Date:- 2021-09-14 07:06:30

What Is Managed Bean?

JavaBean objects managed by a JSF implementation are called managed beans. A managed bean describes how a bean is created and managed. It has nothing to do with the bean's functionalities.

Posted Date:- 2021-09-14 07:06:06

What Typical Jsf Application Consists Of?

A typical JSF application consists of the following parts:

•JavaBeans components for managing application state and behavior.
•Event-driven development (via listeners as in traditional GUI development).
•Pages that represent MVC-style views; pages reference view roots via the JSF component tree.

Posted Date:- 2021-09-14 07:05:39

Explain the required and requiredMessage attribute of the <h:inputText> tag?

Required attribute indicates that the field is mandatory when set to true. The requiredMessage attribute allows users to specify their own message for the ui components when the fields are mandatory. They are used for declarative validations in JSF view pages.

Posted Date:- 2021-09-14 07:05:14

What Are The Available Implementations Of Javaserver Faces?

The main implementations of JavaServer Faces are:

•Reference Implementation (RI) by Sun Microsystems.
•Apache MyFaces is an open source JavaServer Faces (JSF) implementation or run-time.
•ADF Faces is Oracle’s implementation for the JSF standard.

Posted Date:- 2021-09-14 07:04:18

What are the benefits of using JSF Framework?

Some of the benefits of using JSF framework are;

<> Clean separation between presentation and business logic.
<> Manages UI state across multiple server requests.
<> Implementation of custom components.
<> Easier flow of data between the components.
<> JSF specs that helps custom implementations such as PrimeFaces

Posted Date:- 2021-09-14 07:02:38

What is the significance of name and eager attributes in managed bean?

name: The name attribute indicates the managed bean with the name specified. If the name is not specified then the bean name is same as the class name.

eager: If eager is set to “true” then managed bean is created before it is requested for the first time and if set to false the bean is created when it is requested.

Posted Date:- 2021-09-14 07:01:50

Explain @ViewScoped, @SessionScoped, @CustomScoped and @RequestScoped annotations?

@ViewScoped: annotation indicates that the bean is alive as long as the user interacts with the same JSF view page in the browser.
@SessionScoped: annotation indicates that the bean is valid as long as the HTTP session is alive.
@CustomScoped: annotation indicates that the bean lives as long as the bean’s entry in the custom Map which is created for this scope lives.
@RequestScoped: annotation indicates that the Bean lives as long as the HTTP request-response lives.

Posted Date:- 2021-09-14 07:01:06

Explain value expression and method expressions?

Value expressions usually fetch a value or set a value. These expressions can be further categorized into rvalue and lvalue expressions. lvalue expressions can both read and write data whereas rvalue expressions can only read data.

A method expression allows user to invoke a public method of the bean that returns the result necessary for validating the data component and handling events.

Posted Date:- 2021-09-14 07:00:20

What are immediate and deferred value expressions?

Immediate expressions are evaluated and results are rendered as soon as the page is displayed initially. The syntax for immediate evaluation is ${}.

Deferred expressions are evaluated during the lifecycle phase whenever it is requested by the user. The syntax for deferred evaluation is #{expression}.

Posted Date:- 2021-09-14 06:59:58

R4R Team
R4R provides JSF Freshers questions and answers (JSF Interview Questions and Answers) .The questions on R4R.in website is done by expert team! Mock Tests and Practice Papers for prepare yourself.. Mock Tests, Practice Papers,JSF interview question and answers[Experienced],JSF Freshers & Experienced Interview Questions and Answers,JSF Objetive choice questions and answers,JSF Multiple choice questions and answers,JSF objective, JSF questions , JSF answers,JSF MCQs questions and answers R4r provides Python,General knowledge(GK),Computer,PHP,SQL,Java,JSP,Android,CSS,Hibernate,Servlets,Spring etc Interview tips for Freshers and Experienced for JSF fresher interview questions ,JSF Experienced interview questions,JSF fresher interview questions and answers ,JSF Experienced interview questions and answers,tricky JSF queries for interview pdf,complex JSF for practice with answers,JSF for practice with answers You can search job and get offer latters by studing r4r.in .learn in easy ways .