April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Escopo de um Java Bean
nJava Beans possuem escopo.
nJSP usa um modelo de persistência que permite manter um objeto Java (bean) em diferentes escopos.
nPágina atual (page). Este é o valor default.
nRequisição atual (request)
nSessão atual (session)
nDurante o tempo em que o contêiner estiver “no ar” (application)
nO escopo de um bean determina o quanto este bean irá “existir”.
nO atributo scope da tag jsp:useBean é utilizado para definir o escopo de um bean.
• An object with page scope is available during the evaluation of this JSP only. This means
that if the request is forwarded to another page in the same application, the object will not
be preserved.
• An object stored with request scope is available during the entire processing of the current
request from a client. This object will be preserved if the request is forwarded to another
page.
• Session-scoped objects are associated with a user session, which is created when a user
first encounters the server and persists until it is explicitly destroyed or the session times
out. Objects with session scope can be accessed at any point during the session.
• Application-scoped objects are available to any page of any user session, for the life of
the application. They are akin to global variables.
data.