Without Book Interview Questions and Answers | Online Test | Moct Test
Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Institute Training Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

JSF Interview Questions and Answers

Ques 6. How to declare the Navigation Rules for JSF?

Ans. Navigation rules tells JSF implementation which page to send back to the browser after a form has been submitted. For ex. for a login page, after the login gets successful, it should go to Main page, else to return on the same login page, for that we have to code as:


from-outcome to be match with action attribute of the command button of the login.jsp as:

<h:commandbutton value="Login" action="login"/>
Secondly, it should also match with the navigation rule in face-config.xml as

In the UI component, to be declared / used as:

<h:inputText value="#{user.name}"/>
value attribute refers to name property of the user bean.

Is it helpful? Add Comment View Comments
Ques 7. How do I configure the configuration file?
Ans. The configuration file used is our old web.xml, if we use some IDE it will be pretty simple to generate but the contents will be something like below:

<?xml version="e;1.0"e; encoding="e;UTF-8"e;?>
<web-app version="e;2.4"e; xmlns="e;http://java.sun.com/xml/ns/j2ee"e;



<servlet-name>Faces Servlet</servlet-name>

<servlet-name>Faces Servlet</servlet-name>



The unique thing about this file is ?servlet mapping?. JSF pages are processed by a servlet known to be part of JSF implementation code. In the example above, it has extension of .faces. It would be wrong to point your browser to http://localhost:8080/MyJSF/login.jsp, but it has to be http://localhost:8080/MyJSF/login.faces. If you want that your pages to be with .jsf, it can be done with small modification :-),

<servlet-name>Faces Servlet</servlet-name>

Is it helpful? Add Comment View Comments
Ques 8. How does JSF depict the MVC (Model View Controller) model?
Ans. 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.
Is it helpful? Add Comment View Comments
Ques 9. What does it mean by rendering of page in JSF?
Ans. Every JSF page as described has various components made with the help of JSF library. JSF may contain h:form, h:inputText, h:commandButton, etc. Each of these are rendered (translated) to HTML output. This process is called encoding. The encoding procedure also assigns each component with a unique ID assigned by framework. The ID generated is random.
Is it helpful? Add Comment View Comments
Ques 10. What is JavaServer Faces?
Ans. JavaServer Faces (JSF) is a user interface (UI) framework for Java web applications. It is designed to significantly ease the burden of writing and maintaining applications that run on a Java application server and render their UIs back to a target client. JSF provides ease-of-use in the following ways:

  • Makes it easy to construct a UI from a set of reusable UI components
  • Simplifies migration of application data to and from the UI
  • Helps manage UI state across server requests
  • Provides a simple model for wiring client-generated events to server-side application code
  • Allows custom UI components to be easily built and re-used

Most importantly, JSF establishes standards which are designed to be leveraged by tools to provide a developer experience which is accessible to a wide variety of developer types, ranging from corporate developers to systems programmers. A "corporate developer" is characterized as an individual who is proficient in writing procedural code and business logic, but is not necessarily skilled in object-oriented programming. A "systems programmer" understands object-oriented fundamentals, including abstraction and designing for re-use. A corporate developer typically relies on tools for development, while a system programmer may define his or her tool as a text editor for writing code. Therefore, JSF is designed to be tooled, but also exposes the framework and programming model as APIs so that it can be used outside of tools, as is sometimes required by systems programmers.
Is it helpful? Add Comment View Comments

Most helpful rated by users:

©2018 WithoutBook