Mastering JavaServer Faces 2.2
eBook - ePub

Mastering JavaServer Faces 2.2

Anghel Leonard

  1. 578 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Mastering JavaServer Faces 2.2

Anghel Leonard

Book details
Book preview
Table of contents
Citations

About This Book

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.

Approach

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.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Mastering JavaServer Faces 2.2 an online PDF/ePUB?
Yes, you can access Mastering JavaServer Faces 2.2 by Anghel Leonard in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in Java. We have over one million books available in our catalogue for you to explore.

Information

Year
2014
ISBN
9781782176466
Edition
1

Mastering JavaServer Faces 2.2


Table of Contents

Mastering JavaServer Faces 2.2
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Instant updates on new Packt books
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
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
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
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
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
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
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
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
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
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
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
Transf...

Table of contents

Citation styles for Mastering JavaServer Faces 2.2

APA 6 Citation

Leonard, A. (2014). Mastering JavaServer Faces 2.2 (1st ed.). Packt Publishing. Retrieved from https://www.perlego.com/book/390696/mastering-javaserver-faces-22-pdf (Original work published 2014)

Chicago Citation

Leonard, Anghel. (2014) 2014. Mastering JavaServer Faces 2.2. 1st ed. Packt Publishing. https://www.perlego.com/book/390696/mastering-javaserver-faces-22-pdf.

Harvard Citation

Leonard, A. (2014) Mastering JavaServer Faces 2.2. 1st edn. Packt Publishing. Available at: https://www.perlego.com/book/390696/mastering-javaserver-faces-22-pdf (Accessed: 14 October 2022).

MLA 7 Citation

Leonard, Anghel. Mastering JavaServer Faces 2.2. 1st ed. Packt Publishing, 2014. Web. 14 Oct. 2022.