Understanding Scope and Managed Beans

In developing applications, either for the desktop or the Internet, you need to get a good understanding of the concepts of scope, which is the lifespan an object that may last just for that page, for an entire session, or for the duration of an application. In addition, managed beans can save you code time, and is necessary for dealing with the data of your application. A managed bean is a JavaBeans object that stores data in either request scope, session scope, or application scope.

To understand these concepts fully, read the following tutorial and create the sample application.

In this tutorial, you use the NetBeans Visual Web Pack to create an application that demonstrates how to use application, session, and request scopes to manage your application's objects. Scope is the availability (or context) of an object and its intended life span in a web application.

The web application that you create in this tutorial uses an object in application scope to tally votes, and uses an object in session scope to ensure that a user votes only once per session. The application uses a request scope object to display the time that the user submitted the vote. The time is stored in request scope, because the application does not need the value after the response is sent to the client browser.

Contents
- About Scopes
- Adding Properties to Managed Beans
- Creating the Start Page
- Creating the Results Page
- Specifying Page Navigation
- Running the Application
- Doing More

Go to tutorial.

Comments:

Post a Comment:
Comments are closed for this entry.
About

Java Technology Fundamentals are now covered as part of the Core Java Technology Tech Tips. Please go there for more tech tips.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today