CoolInterview.com - World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.




Get it now !!
Send your Resume to 6000 Companies
JSF Interview Questions & Answers - Learning Mode
COOLINTERVIEW.COM J2EE INTERVIEW QUESTIONS JSF INTERVIEW QUESTIONS QUESTIONS & ANSWERS - LEARNING MODE

JSF Interview Questions & Answers - Learning Mode

JavaServer Faces (JSF) is a Java-based web application framework intended to simplify development integration of web-based user interfaces. JavaServer Faces is a standardized display technology which was formalized in a specification through the Java Community Process. JavaServer Faces is a standard Java framework for building user interfaces for Web applications. Most important, it simplifies the development of the user interface, which is often one of the more difficult and tedious parts of Web application development.

Try JSF Interview Questions & Answers - Exam Mode

1 2 3 4 Next

Sort By : Latest First | Oldest First | By Rating

JSF Interview Questions & Answers - Learning Mode
Try JSF Interview Questions & Answers - Exam Mode
Question: What does it mean by render kit in JSF?

Answer: 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. Source: CoolInterview.com
Question: How to mask actual URL to the JSF page?

Answer: You'll need to implement your own version of javax.faces.ViewHandler which does what you need. Then, you register your own view handler in faces-config.xml.

Here's a simple abstract ViewHandler you can extend and then implement the 3 abstract methods for. The abstract methods you override here are where you'll do your conversions to/from URI to physical paths on the file system. This information is just passed right along to the default ViewHandler for JSF to deal with in the Source: CoolInterview.com
Question: How to download PDF file with JSF?

Answer: This is an code example how it can be done with action listener of the backing bean.

Add the following method to the backing bean:


public void viewPdf(ActionEvent event) {
String filename = "filename.pdf";

// use your own method that reads file to the byte array
byte[] pdf = getTheContentOfTheFile(filename);

FacesContext faces = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) faces.getExterna Source: CoolInterview.com
Question: How to terminate the session?

Answer: In order to terminate the session you can use session invalidate method.

This is an example how to terminate the session from the action method of a backing bean:


public String logout() {
FacesContext fc = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession) fc.getExternalContext().getSession(false);
session.invalidate();
return "login_page";
}
Source: CoolInterview.com
Question: What is the difference between the domain object model and a view object?

Answer: 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. Source: CoolInterview.com
Question: What is Managed Bean?

Answer: 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. Source: CoolInterview.com
Question: What are tags in JSF ?

Answer: 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:

1. JSF Core Tags Library
2. JSF Html Tags Library

Even a very simple page uses tags from both libraries. These tags can be used adding the following lines of code at the head of the page.

<%@ taglib uri=?http://java.sun.com Source: CoolInterview.com
Question: What are The main tags in JSF?

Answer: 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.
Source: CoolInterview.com
Question: Who are the users of JSF technology?

Answer: JSF is that it has not only been designed for coding experts but for others also Page authors, Component writers etc. Because of integrating MVC model and flexible in its architecture JSF allows a wide range of users :

1. Page authors :
Web designers have experience with graphic design. They can design look and feel of web application in html/jsp using custom tag libraries of JSF.
2. Application developers :
Application developers can integrate this design with Source: CoolInterview.com
Question: What is required for JSF to get started?

Answer: Following things required for JSF:

* JDK (Java SE Development Kit)
* JSF 1.2
* Application Server (Tomcat or any standard application server)
* Integrated Development Environment (IDE) Ex. Netbeans 5.5, Eclipse 3.2.x, etc.

Once JDK and Application Server is downloaded and configured, one can copy the JSF jar files to JSF project and could just start coding. :-)

If IDE is used, it will make things very smooth and will save your time. Source: CoolInterview.com
Question: What is Java Server Faces expression language ?


Answer: 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. Source: CoolInterview.com
Question: What is the difference between JSP and JSF?

Answer: 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 validation, 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. Source: CoolInterview.com
Question: What do you mean by Bean Scope?

Answer: Bean Scope typically holds beans and other objects that need to be available in the different components of a web application. Source: CoolInterview.com
Question: How to access web.xml init parameters from java code?

Answer: You can get it using externalContext getInitParameter method. For example, if you have:


<context-param>
<param-name>connectionString</param-name>
<param-value>jdbc:oracle:thin:scott/tiger@cartman:1521:O901DB</param-value>
</context-param>

You can access this connection string with:
FacesContext fc = FacesContext.getCurrentInstance();
String connection = fc.getExternalContext().getInitParameter("connectionString");
CoolInterview.com
Question: What are differences between struts and JSF?

Answer: In a nutshell, Faces has the following advantages over Struts:

*

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

The primary advantages of Struts as compared to JavaServer Faces technology are as follows:
*

Because Struts is a web application framework, it has a more sophisticated controller architect Source: CoolInterview.com
Question: How to reload the page after ValueChangeListener is invoked?

Answer: At the end of the ValueChangeListener, call FacesContext.getCurrentInstance().renderResponse() Source: CoolInterview.com
Question: What is Java Server Faces validation model ?


Answer: A mechanism for validating the data a user inputs to a Java Server Faces UI component. Source: CoolInterview.com
Question: What are the JSF life-cycle phases?

Answer: The six phases of the JSF application lifecycle are as follows (note the event processing at each phase):
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 Source: CoolInterview.com
Question: What Is a JavaServer Faces Application?

Answer: JavaServer Faces applications are just like any other Java web application. They run in a servlet container, and they typically contain the following:

* JavaBeans components containing application-specific functionality and data.
* Event listeners.
* Pages, such as JSP pages.
* Server-side helper classes, such as database access beans.
In addition to these items, a JavaServer Faces application also has:
* A custom tag library for rendering UI compo Source: CoolInterview.com
Question: What is the difference between JSP-EL and JSF-EL?

Answer: JSP-EL JSF-EL
In JSP-EL the value expressions are delimited by ${?}. In JSf-EL the value expressions are delimited by #{?}.
The ${?} delimiter denotes the immediate evaluation of the expressions, at the time that the application server processes the page. The #{?} delimiter denotes deferred evaluation. With deferred evaluation ,the application server retains the expression and evaluates it whenever a value is needed.

note:As of JSF 1.2 and JSP 2.1 ,the syntax of both express Source: CoolInterview.com

1 2 3 4 Next



India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.03125 Seconds