Learn and master the new features in the new Eclipse Jakarta Faces (formerly JavaServer Faces or JSF) web framework in this definitive guide written by two of the driving forces of the Faces project and the co-creators of the OmniFaces library. Authors Bauke Scholtz and Arjan Tijms take you through real-world examples that demonstrate how these new features are used with other APIs in Jakarta EE. You’ll see the new and exciting ways Jakarta Faces applications can use to communicate between a client and a server, such as using WebSockets, invoking bean methods directly from Ajax, executing client-side JavaScript when Ajax calls complete, and more
Along the way you’ll broaden your knowledge of Faces components and web APIs best practices, and learn a great deal about the internals of Faces and the design decisions that have been made when building the Faces API. For example, you’ll see what artefacts are now CDI injectable, how CDI changed Faces internally, and what some of the caveats are when working with the CDI versions of a Faces artefact.
Furthermore, you'll build an example application from scratch. After reading The Definitive Guide to Jakarta Faces in Jakarta EE 10, you'll be ready to build your own efficient and secure web applications.
What You Will Learn
- Leverage the new features in Jakarta Faces in Jakarta EE in your existing applications
- Integrate Faces and CDI
- Use the brand new Component Search Expression framework, which enables you to more easily locate components from your template
- Extend the Component Search Expression framework with your own search operators
- Work with the different ways of mapping requests to Faces, make your application use extension-less URLs, and programmatically inspect which resources are present in your application
- Master the best practices for web application development and see which are obsolete
Who This Book Is For
Existing JSF or Java developers who need to create a web UI. No prior knowledge of Faces is required, but the book does skew towards the more experienced developer. Concepts such as dependency injection and MVC are assumed to be known, as is a general knowledge about HTML, HTTP and other web standards.
Author(s): Bauke Scholtz, Arjan Tijms
Edition: 2
Publisher: Apress
Year: 2022
Language: English
Pages: 540
Table of Contents
About the Authors
About the Technical Reviewer
Chapter 1: History
In the Beginning…
The Adolescent Years
On to Maturity
Rejuvenation
Chapter 2: From Zero to Hello World
Installing Java SE JDK
What About Jakarta EE?
Installing WildFly
Installing Eclipse
Configuring Eclipse
Integrating Application Server in Eclipse
Creating New Project in Eclipse
Adjusting Deployment Descriptors
Configuring Jakarta Faces
Creating the Backing Bean Class
Creating the Facelets File
Deploying the Project
Installing H2
Configuring DataSource
Configuring Jakarta Persistence
Creating the Jakarta Persistence Entity
Creating the Jakarta Enterprise Beans Service
Adjusting the Hello World
Chapter 3: Components
Standard HTML Components
Standard Core Tags
Life Cycle
Restore View Phase (First Phase)
Apply Request Values Phase (Second Phase)
Process Validations Phase (Third Phase)
Update Model Values Phase (Fourth Phase)
Invoke Application Phase (Fifth Phase)
Render Response Phase (Sixth Phase)
Ajax Life Cycle
View Build Time
View Render Time
View State
View Scope
Phase Events
Component System Events
Custom Component System Events
Jakarta Tags
Manipulating the Component Tree
Chapter 4: Form Components
Input, Select, and Command Components
Text-Based Input Components
File-Based Input Component
Selection Components
SelectItem Tags
SelectItem Groups
Label and Message Components
Command Components
Navigation
Ajaxifying Components
Navigation in Ajax
GET Forms
Stateless Forms
Chapter 5: Conversion and Validation
Standard Converters
Standard Validators
/
/
/
Immediate Attribute
Custom Converters
Custom Validators
Custom Constraints
Custom Messages
Chapter 6: Output Components
Document-Based Output Components
Text-Based Output Components
Navigation-Based Output Components
Panel-Based Output Components
Data Iteration Component
Editable
Add/Remove Rows in
Select Rows in
Dynamic Columns in
Resource Components
Pass-Through Elements
Chapter 7: Facelets Templating
XHTML
Template Compositions
Single Page Application
Template Decorations
Tag Files
Composite Components
Recursive Composite Component
Implicit EL Objects
Chapter 8: Backing Beans
Model, View, or Controller?
Managed Beans
Scopes
@ApplicationScoped
@SessionScoped
@ClientWindowScoped
@ConversationScoped
@FlowScoped
@ViewScoped
@RequestScoped
@Dependent
Which Scope to Choose?
Where Is @FlashScoped?
Managed Bean Initialization and Destruction
Injecting Jakarta Faces Vended Types
Eager Initialization
Layers
Naming Conventions
Chapter 9: Exception Handling
Custom Error Pages
Ajax Exception Handling
ViewExpiredException Handling
IOException Handling
EJBException Handling
Chapter 10: WebSocket Push
Configuration
Usage
Scopes and Users
Channel Design Hints
One-Time Push
Stateful UI Updates
Site-Wide Push Notifications
Keeping Track of Active Sockets
Client Side Event Handling
Breaking Down Mojarra’s f:websocket Implementation
Chapter 11: Custom Components
Component Type, Family, and Renderer Type
Creating New Component and Renderer
Extending Existing Component
Extending Existing Renderer
Custom Tag Handlers
Packaging in a Distributable JAR
Resource Dependencies
Chapter 12: Search Expressions
Relative Local IDs
Absolute Hierarchical IDs
Standard Search Keywords
Custom Search Keywords
Chapter 13: Security
Jakarta EE Security Overview and History
Protect Access to Resources
Excluded
Unchecked
By Role
Setting the Authentication Mechanism
Setting the Identity Store
Providing Our Custom Jakarta Faces Code
Caller-Initiated Authentication
Remember Me
Activating Remember-Me Service
Logging Out
Custom Principals
Conditionally Rendering Based on Access
Cross-Site Request Forgery Protection
Web Parameter Tampering Protection
Cross-Site Scripting Protection
Source Exposure Protection
Chapter 14: Localization
Hello World, Olá mundo, नमस्ते दुनिया
Configuration
Referencing Bundle in Jakarta Faces Page
Changing the Active Locale
Organizing Bundle Keys
Localizing Conversion/Validation Messages
Obtaining Localized Message in a Custom Converter/Validator
Localizing Enums
Parameterized Resource Bundle Values
Database-Based ResourceBundle
HTML in ResourceBundle
Chapter 15: Extensions
Extension Types
Extending CDI Artifacts
Extending Classical Artifacts
Plug-ins
Dynamic Extensions
Application Configuration Populator
The Application Main Class
Local Extension and Wrapping
Introspection
Index