Book Image

Mastering JavaServer Faces 2.2

By : Anghel Leonard
Book Image

Mastering JavaServer Faces 2.2

By: Anghel Leonard

Overview of this book

Table of Contents (20 chapters)
Mastering JavaServer Faces 2.2
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
The JSF Life Cycle
Index

The request scope


The request scope is bound to the HTTP request-response life cycle.

The request scope is very useful in any web application, and an object defined in the request scope usually has a short lifespan; beans live as long as the HTTP request-response lives. When the container accepts an HTTP request from the client, the specified object is attached to the request scope and it is released when the container has finished transmitting the response to that request. A new HTTP request always comes in a new request scope object. In short, a request scope represents a user's interaction with a web application in a single HTTP request. Commonly, a request scope is useful for simple GET requests that expose some data to the user without requiring to store the data.

Note

The request scope is present in JSF and CDI and functions in the same way. It can be used for nonrich AJAX and non-AJAX requests. For JSF managed beans (@ManagedBean), this is the default scope, when none is specified.

For...