ServletContext has a APPLICATION SCOPE .. [GLOBALLY ACCESSIBLE ACROSS THE
PAGES]
ServletContext has a SESSION SCOPE.. [LOCAL SCOPE......which is mostly used
for intialising purpose].

Application *scope*
Application *scope* is the broadest *scope* and should only be used when
necessary. You can create objects bound at application level in JSPs that
are not session-aware, so application *scope* is useful for storing
information when using these types of JSPs. You can also use
application-bound objects to share data among different sessions of the same
application. When you no longer need objects bound to an application, you
should explicitly remove them to free up memory resources.

*Session* *scope*
In my experience, *session* *scope* is more commonly used than application *
scope*. *Session* *scope* allows you to create and bind objects to a *
session*. You must create objects bound to the *session* in session-aware
JSPs and make them available to all JSPs and servlets in the same *session*.
*Session* *scope* is often used for managing security credentials and for
managing state among multiple pages (such as in a Web-based wizard). As with
application *scope*, objects bound to *session* *scope* should be explicitly
removed when no longer needed. Also, I typically make classes serializable
if I intend to bind their instantiations to the *session* *scope*.

You have a few scopes that you can use:
Request
Page
Session
Application

If you have a request scope, it will only run for the request that is made
on that same moment.
If you have a page scope, the parameters and values will run for that page
the whole time until the server is restarted.
If you have a session scope, all the values will be kept for until the
clients session is destroyed.
And least the application scope, if you apply the application scope, the
values will be kept for the entire application, until the server is
restarted.

On Fri, Oct 9, 2009 at 4:52 AM, Amita Engineer <amitaengin...@gmail.com>wrote:

>
> I am confused with
>
> "Create (and initialize) a Person object and save it as an attribute
> called person in the ServletContext scope"
>
>
> What is ServletContext scope ?
>
> >
>


-- 
Y!M: maiminhhoang

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to