Logo F2FInterview

JSF Interview Questions

Q   |   QA

Usually this can be done in two ways:
(Let’s assume com.j2eebrainJsf.messages is the properties file)
The easiest way is to include the following elements in faces-config.xml file:

<application>
 <resource-bundle>
 <base-name>com.j2eebrainJsf.messages</base-name>
 <var>message</var>
 </resource-bundle>
</application>

Another way is that you can add the f:loadBundle element to each JSF page that needs access to the bundle:

<f:loadBundle baseName = “com.j2eebrainJsf.messages” var=”message”/>

The main six phases that are part of the JSF application lifecycle are :
1. Restore view
2. Apply request values; process events
3. Process validations; process events
4. Update model values; process events
5. Invoke application; process events
6. Render response

The bean instance is configured in the faces-config.xml file:

<managed-bean>
  <managed-bean-name>login</managed-bean-name>
  <managed-bean-class>com.j2eebrainJsf.loginBean</managed-bean-class>
  <managed-bean-scope>request</managed-bean-scope>
</managed-bean>

This means: Construct an object of the class com.j2eebrainJsf.loginBean, give it the name login, and keep it alive for the duration of the request.

JSF supports three Bean Scopes. these are mainly :

Request Scope: This is for a request and gets died of when the response is sent back to the requestor.
Session Scope: The is for a session and is availanble till the session is ended.
Application Scope: The is for the entire duration of the web application. This scope is shared among Request and Session scopes

In JSF applications the JSP pages are used to represent the views JSF has a mechanism to use special tags to improve the views
For each tag there is a associated component. JSF (Sun Implementation) provides 43 tags in two standard JSF tag libraries:

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

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: