Nanduri Amarnath wrote:

> Hi ,
>      I was wondering..if a bean has "application" scope, does it mean that only
> one instance of the bean is created and all the users / pages will be able to
> access that one instance ? Thank you.
>

Yes.  One bean is created (per id -- you can have more than one application-scope
bean if you need them), and is shared among all the servlets and JSP pages in a
particular web application.  In a JSP page, you use <jsp:useBean id="xxx"
scope="application" /> to access this bean.  From a servlet, you use
ServletContext.getAttribute().

If you are running multiple web applications in your server, they generally cannot
see each other's application-scope beans.  (Some servlet engines let you turn the
functionality of ServletContext.getContext(), which lets you access other contexts,
on and off for security reasons.)

>
> Cheers,
> Amar..
>

Craig McClanahan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to