Mastering JavaServer Faces 2.2

Mastering JavaServer Faces 2.2
eBook: $35.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $95.98    Print cover: $59.99
save 6%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Fortify your JSF solutions by combing the powers of JSF 2.x (2.0, 2.1, and 2.2)
  • Get acquainted with the newly introduced features in JSF 2.2, such as the faces flow, stateless views, pass-through attributes and resource library contracts
  • Browse through over 300 well defined JSF applications presented in a concise and clear cut approach

Book Details

Language : English
Paperback : 578 pages [ 235mm x 191mm ]
Release Date : June 2014
ISBN : 1782176462
ISBN 13 : 9781782176466
Author(s) : Anghel Leonard
Topics and Technologies : All Books, Web Development, Enterprise

Table of Contents

Chapter 1: Dynamic Access to JSF Application Data through Expression Language (EL 3.0)
Chapter 2: Communication in JSF
Chapter 3: JSF Scopes – Lifespan and Use in Managed Beans Communication
Chapter 4: JSF Configurations Using XML Files and Annotations – Part 1
Chapter 5: JSF Configurations Using XML Files and Annotations – Part 2
Chapter 6: Working with Tabular Data
Chapter 7: JSF and AJAX
Chapter 8: JSF 2.2 – HTML5 and Upload
Chapter 9: JSF State Management
Chapter 10: JSF Custom Components
Chapter 11: JSF 2.2 Resource Library Contracts – Themes
Chapter 12: Facelets Templating
Appendix: The JSF Life Cycle
  • Chapter 1: Dynamic Access to JSF Application Data through Expression Language (EL 3.0)
    • EL syntax
      • EL operators
      • EL precedence of operators
      • EL reserved words
    • EL immediate and deferred evaluation
    • EL value expressions
      • Referencing a managed bean
      • Referencing a managed bean's properties
      • Referencing a managed bean's nested properties
      • Referencing Java SE enumerated types
      • Referencing collections
      • EL implicit objects
    • EL method expressions
    • The conditional text in JSF
    • Writing a custom EL resolver
    • EL 3.0 overview
      • Working with the assignment operator
      • Working with the string concatenation operator
      • Working with the semicolon operator
      • Exploring lambda expressions
        • Working with collection objects
    • Summary
  • Chapter 2: Communication in JSF
    • Passing and getting parameters
      • Using context parameters
      • Passing request parameters with the <f:param> tag
      • Working with view parameters
      • Calling actions on GET requests
      • Passing attributes with the <f:attribute> tag
      • Setting property values via action listeners
      • Passing parameters using the Flash scope
      • Replacing the <f:param> tag with the JSTL <c:set> tag
      • Sending data through cookies
      • Working with hidden fields
      • Sending passwords
      • Accessing UI component attributes programmatically
      • Passing parameters via method expressions
      • Communicating via the binding attribute
    • Managed bean communication
      • Injecting a managed bean into another bean
      • Communication between managed beans using the application/session map
      • Accessing other managed beans programmatically
    • Summary
  • Chapter 3: JSF Scopes – Lifespan and Use in Managed Beans Communication
    • JSF scopes versus CDI scopes
    • The request scope
    • The session scope
    • The view scope
    • The application scope
    • The conversation scope
    • The flow scope
      • The simple flow
      • Flows with beans
      • Nested flows
      • Configuring flows programmatically
      • Flows and navigation cases
      • Inspecting flow navigation cases
      • Using the initializer and finalizer
      • Using the flow switch
      • Packaging flows
      • Programmatic flow scope
    • Dependent pseudo-scope
    • The none scope
    • The custom scope
      • Writing the custom scope class
      • Resolving a custom scope EL expression
      • Controlling the custom scope lifespan with action listeners
      • Controlling the custom scope lifespan with the navigation handler
    • Managed bean instantiation
    • Beans injection
    • Summary
  • Chapter 4: JSF Configurations Using XML Files and Annotations – Part 1
    • JSF 2.2 new namespaces
    • JSF 2.2 programmatic configuration
    • Configuring managed beans in XML
    • Working with multiple configuration files
    • Configuring locales and resource bundles
    • Configuring validators and converters
    • Configuring navigation
      • Implicit navigation
      • Conditional navigation
      • Preemptive navigation
      • Programmatic Navigation
    • Configuring action listeners
      • Application action listeners
    • Configuring system event listeners
      • Using <f:event>
      • Implementing SystemEventListener
    • Configuring phase listeners
    • Working with @ListenerFor and @ListenersFor
    • Summary
  • Chapter 5: JSF Configurations Using XML Files and Annotations – Part 2
    • Configuring resource handlers
      • Adding CSS and JS resources programmatically
    • Configuring the view handler
    • Overriding JSF renders
    • Working with client behavior functionality
    • JSF factories
      • Configuring the global exception handler
      • Configuring RenderKit factory
      • Configuring PartialViewContext
      • Configuring visitContext
      • Configuring ExternalContext
      • Configuring Flash
      • JSF 2.2 Window ID API
      • Configuring lifecycle
      • Configuring the application
      • Configuring VDL
    • Combined power of multiple factories
    • Summary
  • Chapter 6: Working with Tabular Data
    • Creating a simple JSF table
    • The CollectionDataModel class of JSF 2.2
    • Sorting tables
      • Sorting and DataModel – CollectionDataModel
    • Deleting a table row
    • Editing/updating a table row
    • Adding a new row
    • Displaying row numbers
    • Selecting a single row
    • Selecting multiple rows
    • Nesting tables
    • Paginating tables
    • Generating tables with the JSF API
    • Filtering tables
    • Styling tables
      • Alternate row colors with the rowclasses attribute
      • Highlighting rows on mouse hover
      • Highlighting rows on mouse click
    • Summary
  • Chapter 7: JSF and AJAX
    • A brief overview of the JSF-AJAX lifecycle
    • A simple JSF-AJAX example to get started
    • The JSF-AJAX attributes
      • The execute and render attributes
      • The listener attribute
      • The event attribute
      • The onevent attribute – monitoring AJAX state on client
      • The onerror attribute – monitoring AJAX errors on client
    • Grouping components under <f:ajax> tag
    • Updating input fields with AJAX after validation error
      • The Cancel and Clear buttons
        • Value submitted to a view scoped managed bean
        • Value submitted to a request scoped managed bean
    • Mixing AJAX and flow scope
    • Postback and AJAX
      • Postback request's conditional rendering/executing
    • Is it a non-AJAX request?
    • AJAX and <f:param>
    • Queue control for AJAX requests
    • Explicit loading of jsf.js
      • Depicting the params value
      • Non-UICommand components and jsf.ajax.request
      • Customizing jsf.js
    • AJAX and the progress bar/indicator
    • Summary
  • Chapter 8: JSF 2.2 – HTML5 and Upload
    • Working with HTML5 and JSF 2.2
      • Pass-through attributes
      • Pass-through elements
      • JSF 2.2 – HTML5 and Bean Validation 1.1 (Java EE 7)
    • JSF 2.2 upload feature
      • A simple JSF 2.2 upload example
      • Using multiple <h:inputFile> elements
      • Extracting info about a file to be uploaded
      • Writing uploaded data to a disk
      • Upload validator
      • Ajaxify the upload
      • Uploading images with preview
      • Uploading multiple files
      • Upload and the indeterminate progress bar
      • Upload and the determinate progress bar
    • Summary
  • Chapter 9: JSF State Management
    • JSF saving the view state
      • JSF partial saving view state
      • Partial state saving and tree visiting
      • JSF saving view state on the server or client
      • JSF logical and physical views
      • Saving the state in a database – an experimental application
        • Writing the custom ResponseStateManager class
        • Adding MongoDB in equation
      • Handling ViewExpiredException
      • Server-state serialization in a session
    • JSF 2.2 is stateless
      • The view scoped beans and the stateless feature
      • Detecting stateless views programmatically
    • JSF security notes
      • Cross-site request forgery (CSRF)
      • Cross-site scripting (XSS)
      • SQL injection
    • Summary
  • Chapter 10: JSF Custom Components
    • Building noncomposite custom components
      • Writing a custom tag handler
      • Dissecting a custom component
        • Custom component implementation
    • Building composite components
      • Developing the Temperature composite component
      • Transforming a jQuery component into composite component
      • Writing the HTML5 date picker as a composite component
      • Decorating an image with actions
      • Working with composite facets
      • Validating/converting inputs inside composite components
      • Checking the presence of an attribute
      • Composite components' pitfalls
        • Null values within a composite component's attributes
      • Hiding pass-through attributes in composite components
        • Counting the children of a composite component
        • Top-level component's pitfall
      • Distributing composite components as JARs in JSF 2.2
      • Adding composite components programmatically
    • Summary
  • Chapter 11: JSF 2.2 Resource Library Contracts – Themes
    • Working with contracts
    • Styling tables with contracts
    • Styling UI components with contracts
    • Styling contracts across different devices
    • Writing contracts for composite components
    • Writing a theme switcher
    • Configuring contracts in XML
    • Packaging contracts in JARs
    • Summary
  • Chapter 12: Facelets Templating
    • A brief overview of the Facelets tags
    • Creating a simple template – PageLayout
    • Passing parameters via <ui:param>
    • Passing bean properties and action methods via <ui:param>
    • Exploiting the <ui:decorate> and <ui:fragment> tags
    • Iterating with <ui:repeat>
    • Working with <ui:include> and <f:viewParam>
    • Working with <ui:include> and <ui:param>
    • Debugging with <ui:debug>
    • Removing the content with <ui:remove>
    • Using the jsfc attribute
    • Extending the PageLayout template
    • Facelets' programmatic aspects
      • FaceletFactory considerations
      • Working with FaceletCache
      • ResourceResolver swallowed by ResourceHandler
      • Include Facelets programmatically
      • Creating a TagHandler class
      • Writing custom Facelets taglib functions
    • Facelets pitfalls
      • AJAX and <ui:repeat>
      • Exemplifying <c:if> versus <ui:fragment>
      • Exemplifying <c:forEach> versus <ui:repeat>
    • Summary

Anghel Leonard

Anghel Leonard is a senior Java developer with more than 13 years of experience in Java SE, Java EE, and related frameworks. He has written and published more than 50 articles about Java technologies and more than 500 tips and tricks for many websites that are dedicated to programming. In addition, he has written the following books:

  • Tehnologii XML XML în Java, Albastra
  • Jboss Tools 3 Developer's Guide, Packt Publishing
  • JSF 2.0 Cookbook, Packt Publishing
  • JSF 2.0 Cookbook: LITE, Packt Publishing
  • Pro Java 7 NIO.2, Apress
  • Pro Hibernate and MongoDB, Apress

Currently, Anghel is developing web applications using the latest Java technologies on the market (EJB 3.0, CDI, Spring, JSF, Struts, Hibernate, and so on). Over the past two years, he's focused on developing rich Internet applications for geographic information systems.

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Mastering JavaServer Faces 2.2 +    Oracle JRockit: The Definitive Guide =
50% Off
the second eBook
Price for both: $53.70

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Discover how to write custom JSF 2.2 themes, custom factories, handlers, renderers, and components
  • Access unlimited developing scenarios with the concept of dependency injection
  • Enhance your applications with JSF 2.2 upload component and HTML5 friendly markup
  • Master the new JSF 2.2 Window ID technique
  • Gain insights into managing the application state with stateless viewsExplore the new CDI @ViewScoped and @FlowScoped (detailed presentation)

In Detail

JavaServer Faces (JSF) is a leading framework and core component of Java Platform Enterprise Edition. JSF is the standard Java EE technology used to build web user interfaces. JSF 2.2 is a recent release with an extensive list of new features, some of which have been expected for a long time and are now ready to be implemented.

Starting out with a very basic topic, Expression Language, you will continue onwards covering a wide range of JSF sectors, such as JSF communication, JSF scopes, and so on. Throughout the book, you will master JSF artifacts (AJAX, HTML5, configurations,  renders, handlers, listeners, events, factories, tabular data, custom components, Facelets, and so on) in a compendium of programming practices and informative examples.

You then round off with a detailed discussion on the capabilities of Facelets. Overall, this book helps you gain knowledge on the latest JSF features in an interesting and original approach. Adding these skills to your personal arsenal will turn you into a veritable JSF master.


A homogenous guide integrating the features of JSF 2.x (2.0, 2.1 and 2.2), following a “learning through examples” paradigm with its main focus on the advanced concepts of JSF.

Who this book is for

If you are a web developer who uses JSF, this is the book for you. Catering to an intermediate-advanced audience, the book assumes you have fundamental knowledge of JSF. It is intended for the developer who wants to improve their skills with the combined power of JSF 2.0, 2.1, and 2.2.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software