Logo F2FInterview

JSF Interview Questions

Q   |   QA

In JSF, there is a viewstate associated with each page, which is passed back and forth with each submits. The reason for the viewtate is that the HTTP is a stateless protocol. The state of the components across requests need to be maintained. The viewstate can change in between requests as new controls like UIInput can be added or modified.

The main advantages of JSF over Struts are :

  • Eliminated the need for a Form Bean
  • Eliminated the need for a DTO Class
  • Allows the use of the same POJO on all Tiers because of the Backing Bean

As Struts is a web application framework, it has a more sophisticated controller architecture than does JavaServer Faces technology. It is more sophisticated partly because the application developer can access the controller by creating an Action object that can integrate with the controller, whereas JavaServer Faces technology does not allow access to the controller. In addition, the Struts controller can do things like access control on each Action based on user roles. This functionality is not provided by JavaServer Faces technology.

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:

<naviagation-rule>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
  <from-outcome>login</from-outcome>
  <to-view-id>/welcome.jsp</to-view-id>
</navigation-case>
</naviagation-rule>

This declaration states that the login action navigates to /welcome.jsp, if it occurred inside /index.jsp.

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

Components in JSF are objects that manage interaction with a user. Components help developers to create UIs by assembling a number of components , associating them with object properties and event handlers.

The different components in JSF are elements like text box, button, table etc. that are used to create user interfaces of JSF Applications.

Once you have created a component, it’s simple to drop that component onto any JSP. Components in JSF are of two types :

Simple Components like text box, button and Compound Components like table, data grid etc.

A component containing many components inside it is called a compound component.

JSF allows you to create and use components of two types:

1. Standard UI Components:
JSF contains its basic set of UI components like text box, check box, list boxe, button, label, radio button, table, panel etc. These are called standard components.

2. Custom UI Components:
Generally UI designers need some different , stylish components like fancy calendar, tabbed panes . These types of components are not standard JSF components. JSF provides this additional facility to let you create and use your own set of reusable components. These components are called custom components.

In order to link this F2FInterview's page as Reference on your website or Blog, click on below text area and pres (CTRL-C) to copy the code in clipboard or right click then copy the following lines after that paste into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code: