Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Mastering JavaServer Faces 2.2
Mastering JavaServer Faces 2.2

Mastering JavaServer Faces 2.2: Master the art of implementing user interfaces with JSF 2.2

Arrow left icon
Profile Icon Anghel Leonard
Arrow right icon
Mex$179.99 Mex$1082.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3 (15 Ratings)
eBook Jun 2014 578 pages 1st Edition
eBook
Mex$179.99 Mex$1082.99
Paperback
Mex$1353.99
Subscription
Free Trial
Arrow left icon
Profile Icon Anghel Leonard
Arrow right icon
Mex$179.99 Mex$1082.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3 (15 Ratings)
eBook Jun 2014 578 pages 1st Edition
eBook
Mex$179.99 Mex$1082.99
Paperback
Mex$1353.99
Subscription
Free Trial
eBook
Mex$179.99 Mex$1082.99
Paperback
Mex$1353.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Mastering JavaServer Faces 2.2

Chapter 2. Communication in JSF

Communication is the core of a JSF application, and is one of the main aspects that dictate the architecture of such an application. Thinking of the big picture, you need to identify—right from the start—the main parts and how they will communicate with one another and with the end user. After selecting design patterns, drawing the UML diagrams, and sketching the architecture and the application flow, it's time to get to work and start implementing the communication pipes using forms, parameters, arguments, values, pages, beans, and so on.

Fortunately, JSF provides many solutions for ensuring a powerful and flexible communication layer between JSF components and also between JSF and XHTML pages, the JavaScript code, and other third-party components. In this chapter, we will cover the following topics:

  • Using context parameters
  • Passing request parameters with the <f:param> tag
  • Working with view parameters
  • Calling actions on GET...

Passing and getting parameters

As you will see in the next sections, JSF provides several approaches to pass/get parameters to/from Facelets, managed beans, UI components, and so on.

Using context parameters

Context parameters are defined in the web.xml file using the <context-param> tag. This tag allows two important children: <param-name>, which indicates the parameter name, and <param-value>, which indicates the parameter value. For example, a user-defined context parameter looks like the following code:

<context-param>
  <param-name>number.one.in.ATP</param-name>
  <param-value>Rafael Nadal</param-value>
</context-param>

Now, in a JSF page, you can access this parameter as shown in the following code:

<h:outputText value="#{initParam['number.one.in.ATP']}"/>
<h:outputText value="#{facesContext.externalContext.initParameterMap['number.one.in.ATP']}"/>

In a managed bean, the same context...

Managed bean communication

Until now, we have focused especially on the communication between Facelets and managed beans. In this section, we will cover another important aspect regarding JSF communication—managed beans communication. We will discuss the following topics:

  • Injecting a managed bean into another bean
  • Communication between managed beans using the application/session map
  • Accessing other managed beans programmatically

Injecting a managed bean into another bean

A managed bean can be injected into another managed bean using @ManagedProperty. For example, let's suppose that you have a managed bean in the session scope that stores a player name and surname, as shown in the following code:

@Named
@SessionScoped
public class PlayersBean implements Serializable{

  private String playerName;
  private String playerSurname;

  public PlayersBean() {
    playerName = "Rafael";
    playerSurname = "Nadal";
  }

//getters and setters
}

Now, let's suppose that...

Summary

Communication in JSF is one of the most important aspects, since the entire application's flow spins around the capability of processing and sharing data between JSF components. As you have seen, there are many ways to pass/get parameters and to access managed beans from other managed beans, but choosing the right ones for obtaining a robust, harmonious, balanced application depends on experience. This chapter covers a wide range of solutions for building communication pipes between JSF components, but, as any developer knows, there is always a case that requires a new approach!

See you in the next chapter, where we will talk about JSF scopes.

Left arrow icon Right arrow icon

Description

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. 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.

What you will learn

  • 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)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 25, 2014
Length: 578 pages
Edition : 1st
Language : English
ISBN-13 : 9781782176473
Vendor :
Apache
Languages :
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jun 25, 2014
Length: 578 pages
Edition : 1st
Language : English
ISBN-13 : 9781782176473
Vendor :
Apache
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Mex$ 2,358.98
Primefaces Cookbook Second Edition
Mex$1004.99
Mastering JavaServer Faces 2.2
Mex$1353.99
Total Mex$ 2,358.98 Stars icon
Banner background image

Table of Contents

14 Chapters
1. Dynamic Access to JSF Application Data through Expression Language (EL 3.0) Chevron down icon Chevron up icon
2. Communication in JSF Chevron down icon Chevron up icon
3. JSF Scopes – Lifespan and Use in Managed Beans Communication Chevron down icon Chevron up icon
4. JSF Configurations Using XML Files and Annotations – Part 1 Chevron down icon Chevron up icon
5. JSF Configurations Using XML Files and Annotations – Part 2 Chevron down icon Chevron up icon
6. Working with Tabular Data Chevron down icon Chevron up icon
7. JSF and AJAX Chevron down icon Chevron up icon
8. JSF 2.2 – HTML5 and Upload Chevron down icon Chevron up icon
9. JSF State Management Chevron down icon Chevron up icon
10. JSF Custom Components Chevron down icon Chevron up icon
11. JSF 2.2 Resource Library Contracts – Themes Chevron down icon Chevron up icon
12. Facelets Templating Chevron down icon Chevron up icon
A. The JSF Life Cycle Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3
(15 Ratings)
5 star 60%
4 star 26.7%
3 star 6.7%
2 star 0%
1 star 6.7%
Filter icon Filter
Top Reviews

Filter reviews by




pavel pscheidl Jul 11, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book has something for everyone. For beginners, it explains the very basics, plus it provides understanding how JSF is connected with other vital technologies. And it even goes the extra mile to give beginners some healthy tips in the beginning. For those who are already familiar with current or previous revisions of JavaServer Faces technology, this books offers exhaustive tour of what JSF can actually do. Latest topics, like using lambdas in EL, is also covered.On the top of it, the language level of this book is very pleasant. When used as a reference guide, information can be found quite easily without getting lost in long paragraphs of useless text. Also, there are code samples to be found everywhere.
Amazon Verified review Amazon
Nubye Oct 25, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Very practical. I recommend first read JavaServer Faces: Introduction by ExampleJuneau, Josh.
Amazon Verified review Amazon
Sergiy Pylypets Dec 21, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
While not being a beginer's tutorial, this book provides practical receipts and best practices for using JSF technology, including the latest features, like HTML5 and file upload support, resource library contracts, etc.Chapter 1, Dynamic Access to JSF Application Data through Expression Language (EL 3.0), contains detailed description of recent version of Expression Language (3.0), which is used in JSF 2.2, including advanced topics like creation of custom EL resolvers.Chapter 3, JSF Scopes – Lifespan and Use in Managed Beans Communication, describes all JSF scopes, including the flow scope, which allows us to demarcate a set of logically related pages or views with an entry point and an exit point.Chapter 6, Working with Tabular Data, is devoted to the creation of data tables, which are a common feature of enterprise applications.In chapter 9, JSF State Management, some security aspects of the usage of JSF technology are discussed.Chapter 10, JSF Custom Components, provides detailed instructions for creating custom JSF components, that gives us a powerful tool for extending JSF functionality and addressing sofisticated requirements and specifications.The book language is precise, clear, and easy-to-understand. The book text contains useful tip and warning sections; new and important words are highlighted.Discussed topics are illustrated by numerous code examples and neat tables and diagrams.Each chapter has a reference to the corresponding source code folder containing ready-to-run Maven projects, relevant to the topics discussed in the chapter.This book can be useful for any Java developer or software engineer, who works with JSF technology.
Amazon Verified review Amazon
Iv� Apr 06, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is the best book of JSF!!
Amazon Verified review Amazon
donald c conway Oct 31, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Excellent book on using JSF
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.