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: 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: What are the available implementations of JavaServer Faces?

Answer: The main implementations of JavaServer Faces are:

* Reference Implementation (RI) by Sun Microsystems.
* Apache MyFaces is an open source JavaServer Faces (JSF) implementation or run-time.
* ADF Faces is Oracle?s implementation for the JSF standard. Source: CoolInterview.com
Question: How to show Confirmation Dialog when user Click the Command Link?

Answer: h:commandLink assign the onclick attribute for internal use. So, you cannot use it to write your own code. This problem will fixed in the JSF 1.2. For the current JSF version you can use onmousedown event that occurs before onclick. <script language="javascript"> function ConfirmDelete(link) { var delete = confirm('Do you want to Delete?'); if (delete == true) { link.onclick(); } } </script> . . . . <h:commandLink action="delete" onmousedown="return ConfirmDelete(this);"&g Source: CoolInterview.com
Question: What is JSF life cycle and its phases?

Answer: The series of steps followed by an application is called its life cycle. A JSF application typically follows six steps in its life.

1. Restore view phase
2. Apply request values phase
3. Process validations phase
4. Update model values phase
5. Invoke application phase
6. Render response phase 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 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 third party components and how they are useful?

Answer: One of the greatest power of JSF is to support third party components . Third party components are custom components created by another vendor. Several components are available in the market, some of them are commercial and some are open source . These pre-built & enhanced components can be used in UI of your web application. For example, we are in need of a stylish calendar then we have an option to take it from third party rather than creating it our own. This will help saving time & cost cre Source: CoolInterview.com
Question: What are the different kinds of Bean Scopes in JSF?

Answer: JSF supports three Bean Scopes. viz.,

* Request Scope: The request scope is short-lived. It starts when an HTTP request is submitted and ends when the response is sent back to the client.
* Session Scope: The session scope persists from the time that a session is established until session termination.
* Application Scope: The application scope persists for the entire duration of the web application. This scope is shared among all the requests and sessions.
Source: CoolInterview.com
Question: How to access web.xml init parameters from jsp page?

Answer: You can get it using initParam pre-defined JSF EL valiable.

For example, if you have:


<context-param>
<param-name>productId</param-name>
<param-value>2004Q4</param-value>
</context-param>

You can access this parameter with #{initParam['productId']} . For example:


Product Id: <h:outputText value="#{initParam['productId']}"/>
Source: CoolInterview.com
Question: How JSF Fits For Web Applications?

Answer: JSF has many advantages over other existing frameworks that makes it a better choice for Java web application development. Some of the reasons are below:

1. Easy creation of UI:
It makes easier to create complex UI for an applicaton using jsf tags.Its APIs are layered directly on top of servlet APIs that enables us to use presentation technology other than JSP,creating your own custom components and rendering output for various client devices.
2. Capacity to handle co 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: What is JavaServer Faces Technology ?


Answer: A framework for building server-side user interfaces for Web applications written in the Java programming language. 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: How to print out html markup with h:outputText?

Answer: The h:outputText has attribute escape that allows to escape the html markup. By default, it equals to "true". It means all the special symbols will be replaced with '&' codes. If you set it to "false", the text will be printed out without ecsaping.


For example, <h:outputText value="<b>This is a text</b>"/>

will be printed out like:

<b>This is a text</b>

In case of <h:outputText escape="false" value="<b>This is Source: CoolInterview.com
Question: How to declare the Message Bundle in JSF?

Answer: We can declare the message bundle in two ways:
(Let?s assume com.developersBookJsf.messages is the properties file)

1. The simplest way is to include the following elements in faces-config.xml file:
<application>
<resource-bundle>
<base-name>com.developersBookJsf.messages</base-name>
<var>message</var>
</resource-bundle>
</application>
2. Alternatively, you can add the f:loadBundle element to each JSF 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 Backing Bean?

Answer: Backing beans are JavaBeans components associated with UI components used in a page. Backing-bean management separates the definition of UI component objects from objects that perform application-specific processing and hold data.

The backing bean defines properties and handling-logics associated with the UI components used on the page. Each backing-bean property is bound to either a component instance or its value. A backing bean also defines a set of methods that perform functions 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

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