Apple WebObjects 3.5 Manual de usuario Pagina 48

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 120
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 47
Chapter 2 Enhancing Your Application
48
Before doing this, it is important to understand the scope and life span of
variables in WebObjects:
Component variables, such as
currentGuest, exist for the lifetime of the
component. These variables are defined in the component (in this case,
Main.java) and are accessible only by its methods. Each user that uses a
component gets a separate instance of the variable.
Session variables exist for the lifetime of one user’s session and are accessible
by all code in the session. They are defined in
Session.java. An instance of each
session variable is created for each user.
Application variables live as long as the application does and are accessible by
all code in the application. They are defined in
Application.java. A single
instance of an application variable is shared by all users of the application.
Creating a Guest List
To store the information from all guests that have accessed the application,
you’ll create an application variable called
allGuests, which exists for the life of the
application.
1. In Project Builder, select Classes in the first column of the Browser. Then
select
Application.java from the second column.
The application’s code appears in the window. The following figure shows
the code generated by the Wizard, along with code you will add.
Vista de pagina 47
1 2 ... 43 44 45 46 47 48 49 50 51 52 53 ... 119 120

Comentarios a estos manuales

Sin comentarios