Table Of ContentBauke Scholtz and
Arjan Tijms
The Definitive Guide to JSF in Java
EE 8
Building Web Applications with
JavaServer Faces
Bauke Scholtz
Willemstad, Curaçao Arjan Tijms
Amsterdam, Noord-Holland, The Netherlands
Any source code or other supplementary material referenced
by the author in this book is available to readers on GitHub via
the book’s product page, located at
www.apress.com/9781484233863 . For more detailed
information, please visit http://www.apress.com/source-code .
ISBN 978-1-48423386-3
e-ISBN 978-1-4842-3387-0
https://doi.org/10.1007/978-1-4842-3387-0
Library of Congress Control Number: 2018942178
© Bauke Scholtz, Arjan Tijms 2018
This work is subject to copyright. All rights are reserved by
the Publisher, whether the whole or part of the material is
concerned, specifically the rights of translation, reprinting,
reuse of illustrations, recitation, broadcasting, reproduction on
microfilms or in any other physical way, and transmission or
information storage and retrieval, electronic adaptation,
computer software, or by similar or dissimilar methodology
now known or hereafter developed.
Trademarked names, logos, and images may appear in this
book. Rather than use a trademark symbol with every
occurrence of a trademarked name, logo, or image we use the
names, logos, and images only in an editorial fashion and to
the benefit of the trademark owner, with no intention of
infringement of the trademark. The use in this publication of
trade names, trademarks, service marks, and similar terms,
even if they are not identified as such, is not to be taken as an
expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to
be true and accurate at the date of publication, neither the
authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made.
The publisher makes no warranty, express or implied, with
respect to the material contained herein.
Distributed to the book trade worldwide by Springer Science+Business Media New
York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-
SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit
www.springeronline.com. Apress Media, LLC is a California LLC and the sole
member (owner) is Springer Science + Business Media Finance Inc (SSBM
Finance Inc). SSBM Finance Inc is a Delaware corporation.
To caffeine and our (not so) patient wives.
Table of Contents
1. Chapter 1: History
1. In the Beginning . . .
2. The Adolescent Years
3. On to Maturity
4. Rejuvenation
2. Chapter 2: From Zero to Hello World
1. Installing Java SE JDK
1. What About Java EE?
2. Installing Payara
1. How About Other Servers?
3. Installing Eclipse
1. Configuring Eclipse
2. Installing JBoss Tools Plug-in
3. Integrating New Server in Eclipse
4. Creating New Project in Eclipse
1. Creating the Backing Bean Class
2. Creating the Facelets File
3. Deploying the Project
5. Installing H2
1. Configuring DataSource
2. Configuring JPA
3. Creating the JPA Entity
4. Creating the EJB Service
5. Adjusting the Hello World
3. Chapter 3: Components
1. Standard HTML Components
2. Standard Core Tags
3. Life Cycle
1. Restore View Phase (First Phase)
2. Apply Request Values Phase (Second Phase)
3. Process Validations Phase (Third Phase)
4. Update Model Values Phase (Fourth Phase)
5. Invoke Application Phase (Fifth Phase)
6. Render Response Phase (Sixth Phase)
4. Ajax Life Cycle
5. View Build Time
6. View Render Time
7. View State
8. View Scope
9. Phase Events
10. Component System Events
11. Custom Component System Events
12. JSTL Core Tags
13. Manipulating the Component Tree
4. Chapter 4: Form Components
1. Input, Select, and Command Components
2. Text-Based Input Components
3. File-Based Input Component
4. Selection Components
5. SelectItem Tags
6. SelectItemGroup
7. Label and Message Components
8. Command Components
9. Navigation
10. Ajaxifying Components
11. Navigation in Ajax
12. GET forms
13. Stateless Forms
5. Chapter 5: Conversion and Validation
1. Standard Converters
1. <f:convertNumber>
2. <f:convertDateTime>
2. Standard Validators
1. <f:validateLongRange>/<f:validateDoubleRange>
2. <f:validateLength>/<f:validateRegex>
3. <f:validateRequired>
4. <f:validateBean>/<f:validateWholeBean>
3. Immediate Attribute
4. Custom Converters
5. Custom Validators
6. Custom Constraints
7. Custom Messages
6. Chapter 6: Output Components
1. Document-Based Output Components
2. Text-Based Output Components
3. Navigation-Based Output Components
4. Panel-Based Output Components
5. Data Iteration Component
1. Editable <h:dataTable>
2. Add/Remove Rows in <h:dataTable>
3. Select Rows in <h:dataTable>
4. Dynamic Columns in <h:dataTable>
6. Resource Components
7. Pass-Through Elements
7. Chapter 7: Facelets Templating
1. XHTML
2. Template Compositions
3. Single Page Application
4. Template Decorations
5. Tag Files
6. Composite Components
1. Recursive Composite Component
7. Implicit EL Objects
8. Chapter 8: Backing Beans
1. Model, View, or Controller?
2. Managed Beans
3. Scopes
1. @ApplicationScoped
2. @SessionScoped
3. @ConversationScoped
4. @FlowScoped
5. @ViewScoped
6. @RequestScoped
7. @Dependent
4. Which scope to choose?
5. Where Is @FlashScoped?
6. Managed bean initialization and destruction
7. Injecting JSF vended types
8. Eager Initialization
9. Layers
10. Naming Conventions
9. Chapter 9: Exception Handling
1. Custom Error Pages
2. Ajax Exception Handling
3. ViewExpiredException Handling
4. IOException Handling
5. EJBException Handling
10. Chapter 10: WebSocket Push
1. Configuration
2. Usage
3. Scopes and Users
4. Channel Design Hints
5. One-Time Push
6. Stateful UI Updates
7. Site-Wide Push Notifications
8. Keeping Track of Active Sockets
9. Detecting Session and View Expiration
10. Breaking Down Mojarra’s f:websocket Implementation
11. Chapter 11: Custom Components
1. Component Type, Family, and Renderer Type
2. Creating New Component and Renderer
3. Extending Existing Component
4. Extending Existing Renderer
5. Custom Tag Handlers
6. Packaging in a Distributable JAR
7. Resource Dependencies
12. Chapter 12: Search Expressions
1. Relative Local IDs
2. Absolute Hierarchical IDs
3. Standard Search Keywords
4. Custom Search Keywords
13. Chapter 13: Security