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

What are the page navigation rules in JSF?

The JSF specification has its own set of rules specified in navigating the pages in JSF. They are such as which view has to be displayed or redirected based on the clicked button or the link on the previous web or JSF page. A set of navigation rules exist in order to redirect the pages and render the data content on to the web page of the device browser.

What is Resource bundling in JSF?

Resource Bundling mainly stores the UI date, label, status messages, and UI textual elements separately in the properties file and does not do any hardcoding in the page. It is one of the most convenient methods. Resource bundles are stored in .inproperties file extension because they are key-value pair of strings. This maintenance keeps the messages in a single place.

What is managed bean and backing bean in JSF?

Managed Bean: It is a basic bean java class of JSF. This java bean is being managed by the JSF framework. It consists of getter and setter methods and business logic. Managed beans generally work for UI component as a model. It can be easily accessed from the JSF page. Backing Bean: It is a subpart of the managed bean. It contains all the properties of UI components in a JSF page.

This bean is used in UI conversion, component validations, and event handling. Almost all the features of UI components binds with a backing bean in JSF page.

Why is JSF used for?

The primary purpose of JSF is to make the construction process of the user interface simple. This UI is used for server-based applications, and the components can be reusable in a page. It connects the UI widgets with data sources. It provides the standard UI components and API (Application Programming Interface) majorly for developing components.

What is Backing Bean in JSF?

The Backing beans in JSF are the Java Beans which are used to implement the UI or front end logic in order to manage the data flow between the business tier and web server tier. Ideally, one backing bean does exist for each JSF page. In JSF 1.2 version, a managed bean should be registered in JSF configuration file facesconfig.xml in order to make it functional. From JSF 2.0 version onwards the same configuration can be avoided and Annotations can be used to apply this configuration.

8. Explain value expression and method expressions in JSF?

The Value expression usually fetches a value or a set of values. These expressions can be categorized into rvalue and Ivalue expressions. The Ivalue expressions can read as well as write data whereas on the other hand rvalue expression can only read the data.

The method expression allows the users to involve a public method of the bean which returns the result that is important for validation of the data component and for handling the events.

Can we integrate JSF with other popular frameworks like Spring, Hibernate, etc.?

Yes, it is possible with all popular frameworks. Typically, a JSF, Spring, Hibernate, etc. collaboration application configuration. not complicated, but because of the amount of code required, they will not be given here. See the documentation for the required framework.

Compare the JSF and Spring Framework.

Spring uses Inversion of Control (IoC) and Dependency Injection (DI), but JSF does not.

Spring consists of many different modules, such as Spring Data, Security, MVC, and many other perfectly interacting parts. This helps create larger applications at lower cost, while JSF is likely to require more coding for the many necessary functions.

Using DI in the spring allows you to embed POJO classes, while JSF can only work with JEE architecture.

Can there be no faces-config.xml for JSF application?

You can opt out of the xml file when using annotations in the code.

What is the difference between JSF-1 and JSF-2?

JSF 1 need to forget :). Does not support Ajax, annotations, the use of templates and generally quite a curve in terms of stability.

What is a render kit?

Render kit defines a set of components and classes that are suitable for display to a specific user. For example, <f: view renderKitId = “PRIMEFACES_MOBILE” /> means using the mobile set of components of the Primefaces library.

​​How to implement internationalization (localization) (i18n) in JSF?

There are various ways to implement localization in JSF, both by standard methods and using other frameworks (for example, Spring). The main meaning of localization in JSF is the absence of hardcoded component values, text data, etc. in the code. You must set a property and link it using the resource bundle file, which will store the set of values ​​for each language (locale).

List the benefits of a data table in JSF.

The use of the table component in JSF provides ample opportunities to work with collections or arrays and display their contents in a table. It supports iteration, provides data conversion capabilities in the required form, and much more.

What is the minimum configuration required for a JSF application?

You must configure at least two configuration files:

web.xml – the main web application configuration file. Contains deployment details, application configuration, and JSF handlers.

faces-config.xml – provides application settings, managed beans, navigation, converters, validators.

Explain the purpose of the selectOne menu tag in JSF.

The selectOneMenu component allows you to select one of the list of values. A component may look like a list box, radio buttons, or a menu.

How to display error messages in JSF?

You can display any system errors using the <h: messages> tag , which can refer to a graphical component using the for attribute .

What is the difference between backing bean and managed bean?

In general, at the moment there is an opinion that these concepts should not be distinguished (for example, spring does this). But if you need to somehow answer differently, then:

1. backing bean should be specified in request scoped . Backing bean is associated with a form.
2. Managed bean can be defined in request , session , application scopes. This type of bean is registered in the context of the JSF application and can be invoked or created at any time and place. Managed beans work with JSF graphics components.

How are the various components rendered on the JSF page?

JSF components are displayed on the xhtml page, which includes tag libraries like jsf core, html, facelets tags.

How are the name and eager attributes used in Managed Bean?

name : specifies the unique name of the class (bean) in JSF. If the name is not specified, the name is the same as the name of the class where the first letter is in lower case.

eager : indicates the creation time of the bean. If true, then a bin will be created at the start of the application, if false, the bin will be created upon the first request to it.

Discuss the importance of @ManagedProperty annotation in JSF 2.0.

Using @ManagedProperty annotation, the bean can be injected into another bean property by using the bean’s setter method. We need a value attribute containing the bean name that is required to be injected.

What is the difference between instant and deferred expressions?

Instant expressions are executed and calculated at the stage of rendering the display. Deferred expressions are executed by a direct call. For example, executing a method when clicking a button or getting a property value when building a fragment of a display (for example, when building a table, you need to get data values).

What is a class student?

The class that is associated with the event that occurs is called the listener class. You can create such a class by implementing the interfaces PhaseListener , ActionListener or a method with an input parameter (ValueChangeEvent ev) .

What components are used to display data in a table form?

The main component for working with tables is <h: dataTable>. Contains extensive display and interaction settings between the view and managed beans.

What tags are used for action and navigation?

Tags for action and navigation commands include:

<h: commandButton> – generates an HTML button that confirms the form and thus allows you to start processing the data entered by the user.
<h: commandLink> – generates an HTML hyperlink equivalent to the HTML a

How can you call multiple listeners in JSF?

When there is a need to attach multiple listeners, a JSF tag for value change listeners and the action listeners are used to attach more than one listener to the element. When you make use of the tag syntax, you specify the class which implements the listener interface.

Explain what Java Server Faces application war file directory may contain?

Web application archive (war) file of the JSF application contains the following:

>> web.xml – a web application descriptor configuration resource for web applications.
>> Essential classes in a set of JAR (Java Archive) files.
>> Application classes, Java Server Faces pages, other required resources like image files.
>> Resource files for application configuration.

What are JSF annotations?

Annotation in JSF helps in the development of clear and clean code. It can be used in packages, classes, constructors, interfaces, fields, methods, parameters, variables, or annotations themselves.

There are mainly three categories of annotation – viz. Markers, Single value annotation, Full annotations.

List validator tags available in JSF.

The validator tags are listed below:

f: validateLength is used to validate string length.
f: validateLongRange is used while validating the numeric value range.
f: validateDoubleRange is used while validating float value range.
f: validateRegex: validation compares given regular expression with JSF components.

What are Data Bound table components?

The components that are responsible for displaying the relational data in a tabular format are called data bound table components. The <h:dataTable> tag is used for displaying the data components. The <h:column> tag iterates over each record in the data source displayed in rows.

List expressions JSF Expression Language supports.

Expressions supported are listed below:

>> Immediate value expression
>> Deferred value expression
>> Value expression
>> Method expression

What types of validations are available in JSF?

There are two types of validations in JSF namely, Declarative and Imperative.

>> Declarative validations are invoked using JSF standard validators or Bean validators.
>> Imperative validations are complex user-declared validators that override the standard validation as standard validation messages are not adequate in all cases.

Describe value expression and method expression.

Value expression retrieves a value and sets a value. They are further divided into rvalue expression and lvalue expression. rvalue can only read data, whereas lvalue can read as well write data.

Public method of the bean is invoked by Method expression that returns the result required for validating the data component and event handling.

Describe various text field tags offered by JSF.

Various text field tags are as described below:

<h: inputText> inserts text box adjacent to label field.
<h: inputTextArea> is used as a container for entering numerous characters.
<h: inputSecret> is a type of text field that is used for password field so that the entered data is not revealed.

List types of page navigation JSF supports.

JSF supports the following page navigation types:

>> Conditional navigation
>> Forward versus Redirect navigation
>> Implicit navigation
>> Navigation via managed bean
>> Navigation via Redirect navigation

Explain the advantages of using Facelet.

The advantages are as follows:

>> Fast compile time
>> High-performance rendering
>> Extends its functionality to components and other server-side objects via >> customization
>> Support for code reuse through composite components and templating
>> Compile-time EL validation

What is a Facelet?

Facelets are lightweight page declaration language which uses HTML style templates to build component tree to build Java server faces views.

Some of Facelets feature are listed as below:

>> It uses XHTML for creating web pages.
>> Besides JSF and JSTL tag libraries, it offers Facelets tag libraries.
>> Expression language support, component, and pages templating.

What are the scopes of managed beans?

Managed Beans are a Java class that consists of a set of getter/setter methods and properties. It acts as a model to the JSF framework and offers functionalities like,

1. Component data validation
2. Manage the execution of a component event
3. Processing to decide what page application navigates next
4. JSF use managed beans either by configuring them into an XML file or through annotations.

What is the significance of managed beans in Java Server Faces?

Managed Beans are Java beans that comprise getter and setter methods and have business logic designed in it. It may optionally have a backing bean. They act as a Model for UI components in the MVC framework.

For JSF 1.2, it is required to register them in the JSF configuration file, faces-config.xml, whereas, from JSF 2.0 onwards, annotations are used to register managed beans.

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.

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

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.

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

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.

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.

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

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.

What is Java Server Faces (JSF)?

It is a Java framework based on MVC design that has rich API and tag libraries that offer the creation of server-side user interface components for web development.

JSF has a tag library, API, Facelets, and UI components and managed beans to create web applications.

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

What is a Managed Bean?

A managed bean is a java class registered to JSF which makes interaction between the UI and the business logic possible. Managed Beans can be created using @ManagedBean annotation.

What is JSF?

Java Server Faces (JSF) technology is a front end framework which makes the creation of user interface components easier by reusing the UI components. JSF is designed based on the Model View Controller pattern (MVC) which segregates the presentation, controller and the business logic.

Search
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[Freshers],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 Java, C ,C++, ASP, ASP.net C# ,Struts ,Questions & Answer, Struts2, Ajax, Hibernate, Swing ,JSP , Servlet, J2EE ,Core Java ,Stping, VC++, HTML, DHTML, JAVASCRIPT, VB ,CSS, interview ,questions, and answers, for,experienced, and fresher 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 .