Top Banner

of 39

JSF QnA

Apr 06, 2018

Download

Documents

Nishant Kr
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/3/2019 JSF QnA

    1/39

    1. What is JSF (or JavaServer Faces)?

    A server side user interface component framework for Java technology-based webapplications. JavaServer Faces (JSF) is an industry standard and a framework for buildingcomponent-based user interfaces for web applications.

    JSF contains an API for representing UI components and managing their state; handling events,

    server-side validation, and data conversion; defining page navigation; supportinginternationalization and accessibility; and providing extensibility for all these features.

    2. What are the advantages of JSF?

    The major benefits of JavaServer Faces technology are:

    JavaServer Faces architecture makes it easy for the developers to use. In JavaServerFaces technology, user interfaces can be created easily with its built-in UI componentlibrary, which handles most of the complexities of user interface management.Offers a clean separation between behavior and presentation.Provides a rich architecture for managing component state, processing componentdata, validating user input, and handling events.

    Robust event handling mechanism.Events easily tied to server-side code.Render kit support for different clientsComponent-level control over statefulnessHighly 'pluggable' - components, view handler, etcJSF also supports internationalization and accessibilityOffers multiple, standardized vendor implementations

    3. What are differences between struts and JSF?

    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 controllerarchitecture than does JavaServer Faces technology. It is more sophisticated partlybecause the application developer can access the controller by creating an Actionobject that can integrate with the controller, whereas JavaServer Faces technologydoes not allow access to the controller. In addition, the Struts controller can do thingslike access control on each Action based on user roles. This functionality is not

    provided by JavaServer Faces technology.Struts includes a powerful layout management framework,called Tiles, which allows you to create templates that you canreuse across multiple pages, thus enabling you to establish an overall look-and-feel foran application.

    The Struts validation framework includes a larger set of standard validators, whichautomatically generate both server-side and client-side validation code based on a setof rules in a configuration file. You can also create custom validators and easily includethem in your application by adding definitions of them in your configuration file.

  • 8/3/2019 JSF QnA

    2/39

    The greatest advantage that JavaServer Faces technology has over Struts is its flexible,extensible UI component model, which includes:

    A standard component API for specifying the state and behavior of a wide range of

    components, including simple components, such as input fields, and more complexcomponents, such as scrollable data tables. Developers can also create their owncomponents based on these APIs, and many third parties have already done so and havemade their component libraries publicly available.

    A separate rendering model that defines how to render the components in variousways. For example, a component used for selecting an item from a list can be renderedas a menu or a set of radio buttons.

    An event and listener model that defines how to handle events generated by activatinga component, such as what to do when a user clicks a button.

    Conversion and validation models for converting and validating component data.

    4. What are the available implementations of JavaServer Faces?

    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 Facesis Oracles implementation for the JSF standard.

    6. What typical JSF application consists of?

    A typical JSF application consists of the following parts:

    JavaBeans components for managing application state and behavior.Event-driven development (via listeners as in traditional GUI development).Pages that represent MVC-style views; pages reference view roots via the JSF

    component tree.

    7. What Is a JavaServer Faces Application?

    JavaServer Faces applications are just like any other Java web application. They run in aservlet 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 components on a page.A custom tag library for representing event handlers, validators, and other actions.UI components represented as stateful objects on the server.Backing beans, which define properties and functions for UI components.Validators, converters, event listeners, and event handlers.An application configuration resource file for configuring application resources.

    8. What is Managed Bean?

  • 8/3/2019 JSF QnA

    3/39

    JavaBean objects managed by a JSF implementation are called managed beans. A managedbean describes how a bean is created and managed. It has nothing to do with the bean'sfunctionalities.

    9. What is Backing Bean?

    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 thatperform application-specific processing and hold data.

    The backing bean defines properties and handling-logics associated with the UI componentsused on the page. Each backing-bean property is bound to either a component instance or itsvalue. A backing bean also defines a set of methods that perform functions for the component,such as validating the component's data, handling events that the component fires andperforming processing associated with navigation when the component activates.

    10. What are the differences between a Backing Bean and Managed Bean?

    Backing Beans are merely a convention, a subtype of JSF Managed Beans which have a veryparticular purpose. There is nothing special in a Backing Bean that makes it different from anyother managed bean apart from its usage.

    What makes a Backing Bean is the relationship it has with a JSF page; it acts as a place to putcomponent references and Event code.

    Backing Beans Managed Beans

    A backing bean is anybean that is referencedby a form.

    A managed bean is a backing bean that has been registered withJSF (in faces-config.xml) and it automatically created (andoptionally initialized) by JSF when it is needed.

    The advantage of managed beans is that the JSF framework willautomatically create these beans, optionally initialize them withparameters you specify in faces-config.xml,

    Backing Beans should bedefined only in therequest scope

    The managed beans that are created by JSF can be stored withinthe request, session, or application scopes

    Backing Beans should be defined in the request scope, exist in a one-to-one relationshipwith a particular page and hold all of the page specific event handling code.In a real-worldscenario, several pages may need to share the same backing bean behind the scenes.A backingbean not only contains view data, but also behavior related to that data.

    11. What is view object?

    A view object is a model object used specifically in the presentation tier. It contains the data

    that must display in the view layer and the logic to validate user input, handle events, andinteract with the business-logic tier. The backing bean is the view object in a JSF-basedapplication. Backing bean and view object are interchangeable terms.

    12. What is domain object model?

    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.

  • 8/3/2019 JSF QnA

    4/39

    13. What is the difference between the domain object model and a view object?

    In a simple Web application, a domain object model can be used across all tiers, however, in amore complex Web application, a separate view object model needs to be used. Domain objectmodel is about the business object and should belong in the business-logic tier. It contains thebusiness data and business logic associated with the specific business object. A view objectcontains presentation-specific data and behavior. It contains data and logic specific to the

    presentation tier.

    14. What do you mean by Bean Scope?

    Bean Scope typically holds beans and other objects that need to be available in the differentcomponents of a web application.

    15. What are the different kinds of Bean Scopes in JSF?

    JSF supports three Bean Scopes. viz.,

    Request Scope: The request scope is short-lived. It starts when an HTTP request issubmitted and ends when the response is sent back to the client.

    Session Scope: The session scope persists from the time that a session is establisheduntil session termination.

    Application Scope: The application scope persists for the entire duration of the webapplication. This scope is shared among all the requests and sessions.

    16. What is the difference between JSP-EL and JSF-EL?

    JSP-EL JSF-EL

    In JSP-EL the value expressions aredelimited by ${}.

    In JSf-EL the value expressions are delimited by#{}.

    The ${} delimiter denotes theimmediate evaluation of the expressions,at the time that the application serverprocesses the page.

    The #{} delimiter denotes deferred evaluation.With deferred evaluation ,the application serverretains the expression and evaluates it whenevera value is needed.

    note:As of JSF 1.2 and JSP 2.1 ,the syntax of both expression languages has been unified.

    17. What are The main tags in JSF?

    JSF application typically uses JSP pages to represent views. JSF provides useful specialtags to enhance these views. Each tag gives rise to an associated component. JSF (SunImplementation) provides 43 tags in two standard JSF tag libraries:

    JSF Core Tags Library.JSF Html Tags Library.

    18. How do you declare the managed beans in the faces-config.xml file?

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

    login

    com.developersBookJsf.loginBean

    request

  • 8/3/2019 JSF QnA

    5/39

    This means: Construct an object of the class com.developersBookJsf.loginBean, give it the

    name login, and keep it alive for the duration of the request.

    19. How to declare the Message Bundle in JSF?We can declare the message bundle in two ways:

    (Lets assume com.developersBookJsf.messages is the properties file)1. The simplest way is to include the following elements in faces-config.xml file:

    com.developersBookJsf.messages

    message

    2. Alternatively, you can add the f:loadBundle element to each JSF page that needsaccess to the bundle:

    20. How to declare the page navigation (navigation rules) in faces-config.xml file ?

    Navigation rules tells JSF implementation which page to send back to the browser after aform has been submitted. We can declare the page navigation as follows:

    /index.jsp

    login

    /welcome.jsp

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

    /index.jsp.

    21. What if no navigation rule matches a given action?

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

    22. What are the JSF life-cycle phases?

  • 8/3/2019 JSF QnA

    6/39

    The six phases of the JSF application lifecycle are as follows (note the event processing at eachphase):

    1. Restore view2. Apply request values; process events3. Process validations; process events4. Update model values; process events

    5. Invoke application; process events6. Render response

    23. Explain briefly the life-cycle phases of JSF?

    1. Restore View : A request comes through the FacesServlet controller. Thecontroller examines the request and extracts the view ID, which is determined by thename of the JSP page.2. Apply request values: The purpose of the apply request values phase is for eachcomponent to retrieve its current state. The components must first be retrieved orcreated from the FacesContext object, followed by their values.3. Process validations: In this phase, each component will have its values validatedagainst the application's validation rules.4. Update model values: In this phase JSF updates the actual values of the server-side model ,by updating the properties of your backing beans.5. Invoke application: In this phase the JSF controller invokes the application tohandle Form submissions.6. Render response: In this phase JSF displays the view with all of its components intheir current state.

    More about JSF Lifecycle

    http://www.developersbook.com/jsf/jsf-tutorial/jsf-tutorial.php#2http://www.developersbook.com/jsf/jsf-tutorial/jsf-tutorial.php#2http://www.developersbook.com/jsf/jsf-tutorial/jsf-tutorial.php#2
  • 8/3/2019 JSF QnA

    7/39

    24. What does it mean by render kit in JSF?

    A render kit defines how component classes map to component tags that are appropriate for aparticular client. The JavaServer Faces implementation includes a standard HTML render kit forrendering to an HTML client.

    25. Is it possible to have more than one Faces Configuration file?

    We can have any number of config files. Just need to register in web.xml.Assume that we want to use faces-config(1,2,and 3),to register more than one faces

    configuration file in JSF,just declare in the web.xml file

    javax.faces.CONFIG_FILES

    /WEB-INF/faces-config1.xml,

    /WEB-INF/faces-config2.xml,

    /WEB-INF/faces-config3.xml

  • 8/3/2019 JSF QnA

    8/39

    1) What is JSF?

    JSF stands for Java Server Faces. JSF has set of pre-assembled User Interface (UI). By

    this it means complex components are pre-coded and can be used with ease. It is event-driven programming model. By that it means that JSF has all necessary code for event

    handling and component organization. Application programmers can concentrate on

    application logic rather sending effort on these issues. It has component model thatenables third-party components to be added like AJAX.

    2) What is required for JSF to get started?

    Following things required for JSF:

    JDK (Java SE Development Kit)

    JSF 1.2Application 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.

    3) What is JSF architecture?

    JSF was developed using MVC (a.k.a Model View Controller) design pattern so that

    applications can be scaled better with greater maintainability. It is driven by Java

    Community Process (JCP) and has become a standard. The advantage of JSF is thatits both a Java Web user interface and a framework that fits well with the MVC.It provides clean separation between presentation and behavior. UI (a.k.a User Interface)

    can be created by page author using reusable UI components and business logic part canbe implemented using managed beans.

    4) How JSF different from conventional JSP / Servlet Model?JSF much more plumbing that JSP developers have to implement by hand, such as page

    navigation and validation. One can think of JSP and servlets as the assemblylanguage? under the hood of the high-level JSF framework.

    5) How the components of JSF are rendered? An ExampleIn an application add the JSF libraries. Further in the .jsp page one has to add the tag

    library like:

  • 8/3/2019 JSF QnA

    9/39

    Or one can try XML style as well:

    Once this is done, one can access the JSF components using the prefix attached. If

    working with an IDE (a.k.a Integrated Development Environment) one can easily add

    JSF but when working without them one also has to update/make the faces-config.xml

    and have to populate the file with classes i.e. Managed Beans between

    tags

    6) How to declare the Navigation Rules for JSF?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 codeas:

    /login.jsp

    login

    /main.jsp

    fail

    /login.jsp

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

  • 8/3/2019 JSF QnA

    10/39

    Secondly, it should also match with the navigation rule in face-config.xml as

    user

    core.jsf.LoginBeansession

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

    value attribute refers to name property of the user bean.

    7) How do I configure the configuration file?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:

    com.sun.faces.verifyObjects

    false

    com.sun.faces.validateXmltrue

  • 8/3/2019 JSF QnA

    11/39

    javax.faces.STATE_SAVING_METHOD

    client

    Faces Servlet

    javax.faces.webapp.FacesServlet1

    Faces Servlet

    /faces/*

    30

    index.jsp

    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 hasextension 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 canbe done with small modification :-),

    Faces Servlet

    *.jsf

  • 8/3/2019 JSF QnA

    12/39

    8) What is JSF framework?JSF framework can be explained with the following diagram:

    As can be seen in Figure 1, JSF interacts with Client Devices which ties together withpresentation, navigation and event handling and business logic of web tier model. Hence

    JSF is limited to presentation logic / tier. For Database tier i.e. Database and Web

    services one has to rely on other services.

    9) How does JSF depict the MVC (a.k.a Model View Controller) model?

    The data that is manipulated in form or the other is done by model. The data presented touser 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:

    JSF acts as controller by way of action processing done by the user or triggering of an

    event. For ex.

    , 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: UserButton 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.

    10) What does it mean by rendering of page in JSF?

    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.

  • 8/3/2019 JSF QnA

    13/39

    Tutorial

    JavaServer Faces (JSF) Tutorial

    JavaServer Faces (JSF) TutorialOver the last few years, a variety of frameworks for building Java

    based web applications have been created. For years, Struts haveaided developers build web applications using a variation of theclassic ModelViewController design paradigm. However, JavaServerFaces (JSF) has become a standard part of the Java EE 5 platform,providing both a user interface component framework and the basis for a web applicationframework.

    JSF Introduction

    JavaServer Faces (JSF) is a Java based Web applicationframework that simplifies the development of userinterfaces for enterprise Java applications. JSF

    applications are implemented in Java on the server, andrender as web pages back to clients based on their webrequests. JSF provides Web application lifecyclemanagement through a controller servlet; and like Swing,JSF provides a rich component model complete with eventhandling and component rendering. It is based on otherJava standards such as Java Servlets and JavaServer Pages,but it provides a higherlevel component layer for UI (userinterface) development.

    The major benefits of JavaServer Facestechnology are:

    JavaServer Faces architecture makes it easy forthe developers to use. In JavaServer Facestechnology, user interfaces can be created easily

    with its builtin UI component library, which handles most of the complexities ofuser interface management.JavaServer Faces technology offers a clean separation between behavior andpresentation.JavaServer Faces technology provides a rich architecture for managing componentstate, processing component data, validating user input, and handling events.Robust event handling mechanism.Render kit support for different clientsHighly 'pluggable' components, view handler, etc

    Back to top

    JSF Lifecycle

    http://www.developersbook.com/jsf/jsf-tutorial/jsf-tutorial.php#tophttp://www.developersbook.com/jsf/jsf-tutorial/jsf-tutorial.php#tophttp://www.developersbook.com/jsf/jsf-tutorial/jsf-tutorial.php#tophttp://www.developersbook.com/jsf/jsf-tutorial/jsf-tutorial.php#top
  • 8/3/2019 JSF QnA

    14/39

    In order for you tounderstand how theframework masks theunderlying requestprocessing nature of theServlet API and to

    analyze how Facesprocesses each request,well go through the JSFrequest processinglifecycle. This will allowyou to build betterapplications.

    A JavaServer Faces pageis represented by a treeof UI components, calleda view. During the

    lifecycle, the JavaServer Faces implementation must build the view while considering statesaved from a previous submission of the page. When the client submits a page, theJavaServer Faces implementation performs several tasks, such as validating the data input ofcomponents in the view and converting input data to types specified on the server side. TheJavaServer Faces implementation performs all these tasks as a series of steps in theJavaServer Faces requestresponse life cycle.

    The phases of the JSF application lifecycle are as follows:

    1. Restore view2. Apply request values; process events3. Process validations; process events4. Update model values; process events5. Invoke application; process events6. Render response

    The normal flow of control is shownwith solid lines, whereas dashed lines show alternate flows depending on whether acomponent requests a page redisplay or validation or conversion errors occur.

  • 8/3/2019 JSF QnA

    15/39

    Note : Life cycle handles two kinds of requests:

    Initial request: A user requests the page for the first time.

    Postback: A user submits the form contained on a page that was previously loadedinto the browser as a result of executing an initial request.

    Phase 1 : Restore view

    In the RestoreView phase, JSF classes build the tree of UI components for the incoming

    request.When a request for a JavaServer Faces page is made, such as when a link or a buttonis clicked, the JavaServer Faces implementation begins the restore view phase.

    This is one of thetrickiest parts of JSF: The JSF framework controller uses the view ID (typically JSPname) to look up the components for the current view. If the view isnt available,the JSF controller creates a new one. If the view already exists, the JSF controlleruses it. The view contains all the GUI components and there is a great deal of state

  • 8/3/2019 JSF QnA

    16/39

    management by JSF to track the status of the view typically using HTML hiddenfields.

    If the request for the page is an initial request, the JavaServer Faces implementationcreates an empty view during this phase. Lifecycle only executes the restore viewand render response phases because there is no user input or actions to process.

    If the request for the page is a postback, a view corresponding to this page alreadyexists. During this phase, the JavaServer Faces implementation restores the view byusing the state information saved on the client or the server. Lifecycle continues toexecute the remaining phases.

    Fortunately this is the phase that requires the least intervention by application code.Phase 2 : ApplyRequest values

    During ApplyRequest values, the request parameters are read and their values are used toset the values of the corresponding UI components. This process is called decoding.

    If the conversion of the value fails, an error message associated with the componentis generated and queued on FacesContext. This message will be displayed duringthe render response phase, along with any validation errors resulting from theprocess validations phase.

    If some components on the page have their immediate event handling property is setto true, then the validation, conversion, and events associated with thesecomponents takes place in this phase instead of the Process Validations phase. Forexample, you could have a Cancel button that ignores all values on a form.

    Phase 3 : Process validations

    The Apply Validations phase triggers calls to all registered validators.

    The components validate the new values coming from the request against theapplication's validation rules.Any input can be scanned by any number of validators.These Validators can be pre-defined or defined by the developer.Any validation errors will abort the requesthandling process and skip to renderingthe response with validation and conversion error messages.

    Phase 4 : Update Model Values

    The Update Model phase brings a transfer of state from the UI component tree to any and allbacking beans, according to the value expressions defined for the components themselves.

    It is in this phase that converters are invoked to parse string representations ofvarious values to their proper primitive or object types. If the data cannot beconverted to the types specified by the bean properties, the life cycle advancesdirectly to the render response phase so that the page is re-rendered with errorsdisplayed.

    Note: The difference between this phase and Apply Request Values - that phase

  • 8/3/2019 JSF QnA

    17/39

    moves values from clientside HTML form controls to serverside UI components;while in this phase the information moves from the UI components to the backingbeans.

    Phase 5 : Invoke Application

    The Invoke Application phase handles any application-level events. Typically this takes theform of a call to process the action event generated by the submit button that the userclicked.

    Application level events handledApplication methods invokedNavigation outcome calculated

    Phase 6 : Render Response

    Finally, Render Response brings several inverse behaviors together in one process:

    Values are transferred back to the UI components from the bean. Including anymodifications that may have been made by the bean itself or by the controller.

    The UI components save their state not just their values, but other attributeshaving to do with the presentation itself. This can happen serverside, but by defaultstate is written into the HTML as hidden input fields and thus returns to the JSFimplementation with the next request.

    If the request is a postback and errors were encountered during the apply requestvalues phase, process validations phase, or update model values phase, the original

    page is rendered during this phase. If the pages contain message or messages tags,any queued error messages are displayed on the page.

    Process Events

    In this phase, any events that occurred during the previous phase are handled.

    Each Process Events phase gives the application a chance to handle any events (forexample, validation failures) that occurred during the previous phase.

    Note: Sometimes, an application might need to redirect to a different web applicationresource, such as a web service, or generate a response that does not contain JavaServer

    Faces components. In these situations, the developer must skip the rendering phase (RenderResponse Phase) by calling FacesContext.responseComplete. This situation is also shown inthe diagram, with ProcessEvents pointing to the response arrow.

    JavaServer Faces (JSF) Tutorial

  • 8/3/2019 JSF QnA

    18/39

    JavaServer Faces (JSF) TutorialBy Anand , developersBOOK.COM , 03/01/08

    JSF- Getting startedNow that we have a general overview of JavaServer Facesand a basic understanding of the JSF lifecycle, let's getstarted with some code.

    There are more than one JSF implementations available inmarket. Some of them are:

    Sun (RI) (default)Apache MyFacesIBMSimplica (based on Apache MyFaces)Additionally, there are several 3rd party UIcomponents that should run with anyimplementation.

    For our simple application we use Sun (RI) defaultimplementation.

    Before you can dive into a full-fledged example, you mustlay some groundwork. i.e., configuring your environment to work with JSF. First, you need toget the JSF library files.

    jsf-api.jarjsf-impl.jar

    You should place these two JSF JARfiles (jsf-api.jar and jsf-impl.jar) in the application's classpath, either in the Web app's libdirectory or in the server's classpath. The next thing we'll need to do is download thedependencies our simple project will have. Here are the jar files (apart from above two jars)you will need in your WEB-INF/lib:

    jstl.jarstandard.jarcommons-beanutils.jarcommons-collections.jar

    commons-digester.jarcommons-logging.jar

    Alternatively, use Ant or Maven to only include these jars when you are testing.

    Note: Even though, JSF applications typically use JSP tags implemented by the JSFimplementation, there are no separate tag library descriptor (TLD) files because thatinformation is contained in the jar files.

    Page 2 of 3

  • 8/3/2019 JSF QnA

    19/39

    Figure 2: JSF Helloworld directory structure

    More advanced JSF applications have the same structure, but they can contain additionalJava classes, such as event handlers, validators, and custom components. And optionaladditional configuration files.

    JSF Basic ExampleNow that you know the basic configuration steps, you just need to look at a workingexample. Lets start with Java bean class called PersonBean.java (Code Listing 1) . This classhas only one property, name

    Code Listing 1: PersonBean.java

    packagecom.developersBook.jsf.bean;

    publicclass PersonBean {

    private String name;

    publicvoidsetName(String name) {

    this.name = name;

    }

    public String getName() {

    returnthis.name;

  • 8/3/2019 JSF QnA

    20/39

    }

    }

    In JSF applications, you use beans for all data that needs to be accessible from a page.

    Next you need is JSF page (index.jsp). This JSP is essentially an HTML file with fewadditional tags (JSF tags).Code Listing 2: index.jsp

    JSF Hello World

    To use any of the JavaServer Faces tags, you need to include these taglib directives at thetop of each page containing the tags defined by these tag libraries:

    The uri attribute value uniquely identifies the TLD. The prefix attribute value is used to

    distinguish tags belonging to the tag library. You can use other prefixes rather than the h or

    f prefixes. However, you must use the prefix you have chosen when including the tag in thepage. For example, the form tag must be referenced in the page using the h prefix because

    the preceding tag library directive uses the h prefix to distinguish the tags defined in

    html_basic.tld:

    Much of the page is similar to regular an HTML form, except few differences:

  • 8/3/2019 JSF QnA

    21/39

    All JSF tags are contained in an f:view tag.

    All JSF components are enclosed in h:form tag, instead of using HTML form tag.

    Use h:inputText, h:commandButton, instead of regular HTML input tags.

    You can find the all the standard JSF tags and their attributes with exampleshere.

    The value of action attribute (sayHello or sayBye) ofh:commandButton shapes the outcomeof request. As in our example this action attribute can be literal string or EL methodexpression, i.e, specific method on a specific bean can be called as part of therequest/response cycle.

    In this case , the return value from the method will be the outcome .

    Figure 3: index.jsp

    http://www.developersbook.com/jsf/jsf-tags/jsf-standard-components.phphttp://www.developersbook.com/jsf/jsf-tags/jsf-standard-components.phphttp://www.developersbook.com/jsf/jsf-tags/jsf-standard-components.phphttp://www.developersbook.com/jsf/jsf-tags/jsf-standard-components.php
  • 8/3/2019 JSF QnA

    22/39

    As the above view (index.jsp) will prompt for your name, and populate the person bean

    with the value you enter. The others will say hello or goodbye, depending on which actionthe user chooses.Code Listing 3: Hello.jsp

    Hello World!

    Hello,

    Code Listing 3: Bye.jsp

  • 8/3/2019 JSF QnA

    23/39

    GoodBye World!

    GoodBye,

    When working with JSF, you will have a minimum of two XML configuration files, and you willoften have even more (ex: tiles.xml). It is important that you become familiar with theseconfig files, as they are the key to the flexibility and loose coupling provided by thisarchitecture.

    Faces config (faces-config.xml) JavaServer Faces configuration file. Place this filein the WEB-INF directory. This file lists bean resources and navigation rules.

    Web config (web.xml)this is your standard Web configuration file.

    The next step is to create our /WEB-INF/web.xml descriptor file for our hello web application.

    Code Listing 4: web.xml

  • 8/3/2019 JSF QnA

    24/39

    version="2.5">

    Faces Servlet

    javax.faces.webapp.FacesServlet

    1

    Faces Servlet

    *.faces

    index.jsp

    This is your regular web-config file, except the servlet mapping. All JSF pages are processes by

    a special servlet (FacesServlet) that is a part of the JSF implementation code. The JSF URLshave a special format to ensure that the correct servlet is activated when a JSF page is

    requested. In our example, they have an extension .faces.Ex:http://localhost:8080/hello/index.faces.Note: You can also define a prefix

    mapping instead of the .facesextension mapping.

    ........

    url-pattern>/faces/*

    You are probably wondering how all of this is going to tie together. How does PersonBean get

    into JSP's and how do the input buttons on index.jsp get me to hello.jsp or bye.jsp? That's

    where we need a faces-config (faces-config.xml) file.To cause JSF to proceed from one page to another, you must inform it of the page flows ofyour application. We do this with navigation rules, which predicate the choice of response viewon the outcome of a request. Define navigation rules in your faces-config file.

    Create a file called /WEB-INF/faces-config.xml

    Code Listing 5: faces-config.xml

    http://localhost:8080/hello/index.faceshttp://localhost:8080/hello/index.faceshttp://localhost:8080/hello/index.faceshttp://localhost:8080/hello/index.faces
  • 8/3/2019 JSF QnA

    25/39

    /index.jsp

    sayHello

    /hello.jsp

    sayBye

    /bye.jsp

    person

    com.developersBook.jsf.bean.PersonBean

    request

    *

    index

    /index.jsp

    Navigation Rules

    Navigation rules define almost all the page-flow logic of a JSF application.A navigation rule tells the JSF runtime:

    o For what origin we are setting a rule this is o Where to direct the control in what cases.

  • 8/3/2019 JSF QnA

    26/39

    So JSF takes the decision of what page follows what other page away from the pagedefinition, and puts it in the configuration. It decides where to go next based on theidentity of the requesting view, plus the outcome.

    Figure 4: JSF Navigation Rules

    In particular, if we're coming from

    /index.jsp and the "outcome" is "sayHello", go to the hello.jsp view; if the "outcome" is

    "sayBye", go to the bye.jsp view. The "outcome" is determined by the action property of the

    commandButton elements your "from-view", index.jsp.

    By contrast, simple HTML forms, and Struts, and Spring, all let the view define the requestURLs that originate from various HTML forms, buttons, and links.

    Additionally, you can see we've created a managed-bean called person that is an instance of

    our com.developersBook.jsf.PersonBean class. personBean has request scope, and istherefore available throughout processing of the entire request. Its properties can be accessed

    and set using the #{beanname.propertyname}( Ex:#{person.name}) convention, as shown inall three JSPs.

    Figure 5: Binding UI to Managed Bean

  • 8/3/2019 JSF QnA

    27/39

    With all this in place, you should now be able to compile, build, deploy and run your webapplication. You can download the code of this tutorialhere.

    Conclusion

    JavaServer Faces offers an extremely powerful and flexible framework. Use its power to fityour applications needs. And dont forget that its all about the lifecycle.

    Spring Framework Tutorials

    Previous|12|Next

    Spring Framework Tutorials

    The Spring framework overview:Spring is the de-facto standard in lightweight enterprise application framework. Spring isan open source framework created to address the complexity of enterprise applicationdevelopment. One of the main advantages of the Spring framework is its layeredarchitecture, which allows you to be selective about which of its components you usewhile also providing a consistent framework for J2EE application development.

    However Springs usefulness isnt limited to server-side development. Any Java applicationcan benefit from Spring in terms of simplicity, testability, and loose coupling.

    Spring framwork modules:

    The Spring framework is a layered architecture consisting of seven well-defined modules.The Spring modules are built on top of the core container, which defines how beans are

    http://www.developersbook.com/jsf/jsf-tutorials/JSF-Example.ziphttp://www.developersbook.com/jsf/jsf-tutorials/JSF-Example.ziphttp://www.developersbook.com/jsf/jsf-tutorials/JSF-Example.ziphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.phphttp://www.developersbook.com/jsf/jsf-tutorials/JSF-Example.zip
  • 8/3/2019 JSF QnA

    28/39

    created, configured, and managed, as shown in following figure.

    Each of the modules or components that consist of the Spring framework can stand on itsown or be implemented jointly with one or more of the other modules or components. Thedescription of each component is as follows:

    1. The core container:

    The core container provides the fundamental functionality of the Spring framework. In this moduleprimary component is the BeanFactory, an implementation of the Factory pattern. TheBeanFactory applies theInversion of Control (IOC)pattern to separate an application'sconfiguration and dependency specification from the actual application code.

    2. Spring context module :

    TThe Spring context is a configuration file that provides context information to the Springframework. The Spring context includes enterprise services such as e-mail, JNDI, EJB,internalization, validation, scheduling and applications lifecycle events. Also included is support forthe integration with templating frameworks such as velocity.

    3. Spring AOP module:

    The Spring AOP module allows a software component to be decorated with additional behavior,through its configuration management feature. As a result you can easily AOP-enable any objectmanaged by the Spring framework. The Spring AOP module provides transaction managementservices for objects in any Spring-based application. With Spring AOP you can incorporatedeclarative transaction management into your applications without relying on EJB components.

    4. Spring DAO module:

    The Spring DAO module provides a JDBC-abstraction layer that reduces the need to do tediousJDBC coding and parsing of database-vendor specific error codes. Also, the JDBC packageprovides a way to do programmatic as well as declarative transaction management, not only forclasses implementing special interfaces, but for all your POJOs (plain old Java objects).

    5. Spring ORM module:

    http://www.developersbook.com/spring/inversion-of-control-IOC.phphttp://www.developersbook.com/spring/inversion-of-control-IOC.phphttp://www.developersbook.com/spring/inversion-of-control-IOC.phphttp://www.developersbook.com/spring/inversion-of-control-IOC.php
  • 8/3/2019 JSF QnA

    29/39

    : Spring provides integration with OR mapping tools like Hibernate, JDO and iBATIS. Springtransaction management supports each of these ORM frameworks as well as JDBC.

    6. Spring Web module:

    The Web context module provides basic web-oriented integration features builds on top of the

    application context module, providing contexts for Web-based applications. As a result, the Springframework supports integration with Jakarta Struts. The Web module also eases the tasks ofhandling multi-part requests and binding request parameters to domain objects.

    7. Spring MVC framework module:

    Spring provides a pluggable MVC architecture. The users have a choice to use the web frameworkor continue to use their existing web framework. Spring separates the roles of the controller; themodel object, the dispatcher and the handler object which makes it easier to customize them.Spring web framework is view agnostic and does not push the user to use only JSPs for the view.The user has the flexibility to use JSPs, XSLT, velocity templates etc to provide the view.

    Back to top

    Inversion of Control (Dependency Injection):

    Inversion of control is at the heart of the Spring framework. The basic concept of theInversion of Control pattern (also known as dependency injection) is that you do notcreate your objects but describe how they should be created. You don't directly connectyour components and services together in code but describe which services are needed bywhich components in a configuration file. A container (in the case of the Springframework, the IOC container) is then responsible for hooking it all up.

    The easiest way to understand inversion of control is to see it in example. This basicSpring example demonstrates how you can inject application dependencies through theSpring IOC container.

    Inversion of Control Example:

    It is a simple code for wishing hello and bye. We have two interfaces HelloInterface and

    ByeInterface as listed below:Code Listing 1. HelloService Interface (See Implementation)

    package com.developersBook.springExample.service;

    import com.developersBook.springExample.domain.Name;

    public interface HelloService {

    public String sayHello(Name name);

    }

    Code Listing 2. ByeService Interface (See Implementation)

    package com.developersBook.springExample.service;

    import com.developersBook.springExample.domain.Name;

    http://www.developersbook.com/spring/spring-tutorials/spring-tutorials.php#tophttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials.php#tophttp://developersbook.com/spring/spring-tutorials/Name.phphttp://developersbook.com/spring/spring-tutorials/Name.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials.php#top
  • 8/3/2019 JSF QnA

    30/39

    public interface ByeService {

    public String sayBye(Name name);

    }

    Spring Framework Tutorials 2

    Previous|12|Next

    Spring Framework Tutorials

    With all the interfaces in place, the next thing to consider is how to integrate them in aloosely coupled manner. In following listing you can see the implementation.

    Note that all the setter methods are implemented by Spring configuration beans. All the

    dependencies (that is, the two interfaces) can be injected by the Spring framework usingthese beans. The wishMe() method will then use the services to carry out the remainder of

    the implementation. In hello.xml you can see the Spring configuration file.

    Code Listing 3. HelloBean.java

    package com.developersBook.springExample.bean;

    import java.util.Calendar;

    import com.developersBook.springExample.domain.Name;

    import com.developersBook.springExample.service.ByeService;

    import com.developersBook.springExample.service.HelloService;

    public class HelloBean {

    public Name name;

    public HelloService helloService;

    public ByeService byeService;

    //---------------------------------------------- Getters & Setterspublic void setHelloService(HelloService helloService) {

    this.helloService = helloService;

    }

    public void setByeService(ByeService byeService) {

    this.byeService = byeService;

    http://developersbook.com/spring/spring-tutorials/Name.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials.phphttp://developersbook.com/spring/spring-tutorials/Name.php
  • 8/3/2019 JSF QnA

    31/39

    }

    public Name getName() {

    return name;

    }

    public void setName(Name name) {

    this.name = name;

    }

    //---------------------------------------------- Domain methods

    public String wishMe(Name name) {

    Calendar calendar = Calendar.getInstance();

    //simple if-else to check the time

    if(calendar.get(Calendar.HOUR_OF_DAY) < 12){//Invoking the injected helloService

    return helloService.sayHello(name);

    } else {

    //Invoking the injected byeService

    returnbyeService.sayBye(name);

    }

    }

    }

    Back to topCode Listing 4. hello.xml

    http://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.php#tophttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.php#tophttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.php#top
  • 8/3/2019 JSF QnA

    32/39

    Back to top

    Let's see how the TestClient is invoking these services. We have various ways to load springconfiguration file (hello.xml) to classpath .In our basic example we use

    ClassPathXmlApplicationContext. We will see the other ways of loads inAdvance SpringTutorials.

    Code Listing 4. TestClient.java

    package com.developersBook.springExample.client;

    import

    org.springframework.context.support.ClassPathXmlApplicationContext;

    import com.developersBook.springExample.bean.HelloBean;

    import com.developersBook.springExample.domain.Name;

    public class TestClient {

    public static void main(String[] args) {

    try {

    System.out.println("TestClient started");

    //Load the hello.xml to classpath

    ClassPathXmlApplicationContext appContext =

    new ClassPathXmlApplicationContext(new String[] { "hello.xml"

    });

    System.out.println("Classpath loaded");

    HelloBean helloBean = (HelloBean)

    appContext.getBean("helloBean");

    http://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.php#tophttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.php#tophttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.phphttp://www.developersbook.com/spring/spring-tutorials/advanced-spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/advanced-spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/advanced-spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/advanced-spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/advanced-spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/advanced-spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/advanced-spring-tutorials.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.phphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.php#top
  • 8/3/2019 JSF QnA

    33/39

    Name name = new Name();

    name.setFirstName("Tony");

    name.setLastName("Greg");

    String str = helloBean.wishMe(name);

    System.out.println(str);

    System.out.println("TestClient end");

    } catch (Exception e) {

    e.printStackTrace();

    }

    }

    }

    See the underlined code of the above listing. The TestClient will load the Spring

    configuration files through ClassPathXmlApplicationContext. Once the beans are loaded,

    you can then access them through the getBean() method as shown in Listing .As we defined

    the helloBean definition in hello.xml, which is now loaded to classpath, we can access this

    bean using getBean() method .

    Back to top

    Resources & Downloads

    Download the basic example codehere.

    http://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.php#tophttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.php#tophttp://www.developersbook.com/spring/code/Spring-Example.ziphttp://www.developersbook.com/spring/code/Spring-Example.ziphttp://www.developersbook.com/spring/code/Spring-Example.ziphttp://www.developersbook.com/spring/code/Spring-Example.ziphttp://www.developersbook.com/spring/spring-tutorials/spring-tutorials-2.php#top
  • 8/3/2019 JSF QnA

    34/39

    ********************

    JSF-Spring Integration

    ********************

    Let Spring Manage JSF Beans

    The conventional ways of integrating JavaServer Faces and Spring is using the delegatingresolver and the other is to the FacesContextUtils.

    In this approach of JSF-Spring integration, Inversion of control is applied both by Springand JSF. The salient point here is that the Spring bean in not injected by Spring, insteadthe wiring is done by JSF. Here the Springs just performed a role of container.

    Now the question is, do we need to have the two IOC containers for dependency injection?The answer is yes , but prior to Spring 2.0 release. Now with Spring 2.0 we have the abilityfor custom scopes . With the help of these custom scopes, we have a better approach forJSF-Spring integration. Using this approach, we will allow Spring to manage our backingbean dependencies. This results in no JSF backing beans in its container.

    If youre already familiar withSpring-JSF integration, you know that JSF has built-in support for dependency injection.You may be wondering why you should bother about Spring managed or JSF managedbeans. Its true that JSFs support for setter injection is not all that different from that ofSpring. But remember that Spring offers more than just simple dependency injection.Spring can bring a lot of value-add to JSF. Springs other features (such as declarativetransactions, security, remoting, etc.) could come in handy in a JSF application.

    In this artice, Ill show you how Spring manages beans JSF beans. Im assuming that youare already familiar with JSF. If you are new to JSF or just need a refresher, I recommendthat you have a look atJSF tutorial.

    The easiest way to understand this approach is to see it in example. In this example wewill allow Spring to manage our backing bean dependencies. We will do this by adding theDelegatingVariableResolver and using Spring 2.0 scope support.

    This is a simple trading example. Let's start with domain object.

    TradeData.java

    http://www.developersbook.com/jsf/jsf-tutorials/jsf-tutorials.phphttp://www.developersbook.com/jsf/jsf-tutorials/jsf-tutorials.phphttp://www.developersbook.com/jsf/jsf-tutorials/jsf-tutorials.phphttp://www.developersbook.com/jsf/jsf-tutorials/jsf-tutorials.php
  • 8/3/2019 JSF QnA

    35/39

    ackage com.developersBook.trade.domain;

    ublic class TradeData {

    private long tradeId;

    private String symbol;

    private doubleprice;

    public TradeData() {

    super();

    }

    public TradeData(long tradeId, String symbol, doubleprice) {

    super();

    this.tradeId= tradeId;

    this.symbol = symbol;

    this.price = price;

    }

    public double getPrice() {

    returnprice;

    }

    public voidsetPrice(doubleprice) {

    this.price = price;

    }

    public String getSymbol() {

    return symbol;

    }

    public voidsetSymbol(String symbol) {this.symbol = symbol;

    }

    public long getTradeId() {

    return tradeId;

    }

    public voidsetTradeId(long tradeId) {

    this.tradeId= tradeId;

    }

    }

    ITradeService.java

    ackage com.developersBook.trade.service;

    import com.developersBook.trade.domain.TradeData;

    ublic interface ITradeService {

  • 8/3/2019 JSF QnA

    36/39

    public TradeData getTrade(long tradeId);

    }

    TradeServiceImpl.javaackage com.developersBook.trade.serviceImpl;

    import com.developersBook.trade.domain.TradeData;

    import com.developersBook.trade.service.ITradeService;

    ublic class TradeServiceImpl implements ITradeService {

    public TradeData getTrade(long tradeId) {

    // Your data access logic

    }

    }

    Backing bean to get the trade details:

    TradeBean.javaackage com.developersBook.trade.bean;

    import com.developersBook.trade.domain.TradeData;

    import com.developersBook.trade.service.ITradeService;

    ublic class TradeBean {

    private long tradeId;

    private ITradeService tradeService;

    public voidsetTradeService(ITradeService tradeService) {

    this.tradeService = tradeService;

    }

    public long getTradeId() {

    return tradeId;

    }

    public voidsetTradeId(long tradeId) {

    this.tradeId= tradeId;

    }

    public TradeData getTradeDetails(long tradeId) {

    return tradeService.getTrade(tradeId);

    }

    }

  • 8/3/2019 JSF QnA

    37/39

    JSF with tradeBean as backing bean.

    Trade.jsp (partial)

    Trade.jsp

    Next we need to install the Spring support into the web application. To do this you will

    create a web context parameter in web.xml.

    This tells Spring where to find its applicationContext.xml file, which is used for theSpring's WebApplicationContext.

    Spring has a web application listener that reads the contextConfigLocation files

    (org.springframework.web.context.ContextLoaderListener) and creates the

    WebApplicationContext for the web application.

    Next add the Spring RequestContextListener so that Spring can add the request scopeand session scope.

    eb.xml (partial)......

    contextConfigLocation

    /WEB-INF/applicationContext.xml

    org.springframework.web.context.ContextLoaderListener

  • 8/3/2019 JSF QnA

    38/39

    org.springframework.web.context.request.RequestContextListener

    Faces Servlet

    javax.faces.webapp.FacesServlet

    0

    Faces Servlet

    *.faces

    If you don't you add RequestContextListener you get the following:

    org.springframework.beans.factory.BeanCreationException:

    Error creating bean with name 'tradeBean':

    Scope 'request' is not active for the current thread;

    consider defining a scoped proxy for this bean

    if you intend to refer to it from a singleton;

    nested exception is java.lang.IllegalStateException:

    No thread-bound request found:

    Are you referring to request attributes outside of an actual web request?If you are actually operating within a web request and

    still receive this message,your code is probably

    running outside of DispatcherServlet/DispatcherPortlet:

    In this case, use RequestContextListener or

    RequestContextFilter to expose the current request.

    Caused by: java.lang.IllegalStateException: No thread-bound request found:

    Are you referring to request attributes

    outside of an actual web request?

    If you are actually operating within a web request and still

    receive this message,your code is probably running

    outside of DispatcherServlet/DispatcherPortlet:

    In this case, use RequestContextListener orRequestContextFilter to expose the current request.

    at org.springframework.web.context.request.RequestContextHolder.

    currentRequestAttributes(RequestContextHolder.java:102)

    Next add the DelegatingVariableResolver to faces-config.xml

  • 8/3/2019 JSF QnA

    39/39

    faces-config.xml (partial)

    org.springframework.web.jsf.DelegatingVariableResolver

    Inject the TradeBean into the tradeService using the setter method as follows:

    applicationContext.xml (partial)

    As you can observe faces-config has no managed-beans, instead tradeBean is defined insprings application context in request scope.Now when we click Trade It!! button, we will get the same results, that we would havegotten if JSF managed beans are used.

    You can download the source code of this articlehere.

    http://developersbook.com/articles/jsf/Spring2.0-JSF.ziphttp://developersbook.com/articles/jsf/Spring2.0-JSF.ziphttp://developersbook.com/articles/jsf/Spring2.0-JSF.ziphttp://developersbook.com/articles/jsf/Spring2.0-JSF.zip