Jason
The ServletContext object is shared between all servlets/JSPs in an
application.
getServletContext().setAttribute("<A String>", <An object>) adds an object
to the context
getServletContext().getAttribute("<A String>") gets an object
from the context which has earlier been set
getServletContext().removeAttribute("<A String>") removes an
object from the context
When the scope of a bean in JSP is set to Application, the bean is added to
the ServletContext.
-AMT
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Jason Lee
> Sent: Monday, January 10, 2000 3:51 PM
> To: [EMAIL PROTECTED]
> Subject: useBeas and Application scop
>
>
> I know that you can set the scope for a bean to be Application, but most
> of the docs for it that I have read are pretty vague, so I'll give an
> example.
>
> I have certain categories is a db that I want to access and that users
> will be accessing frequently. So I'm trying to generate a Yahoo! style
> tree listing of categories, which isn't hard to do. However, it doesn't
> make sense to keep makiing all these database calls when I could have it
> it memory.
>
> So I'm thinking about making a separate bean that will hold all of these
> 60 categories I have and set the scope on the bean for application.
> However, it doesn't seem like my servlets could get access to this bean.
> I was thinking req.getAttribute() from a servlet, but I'm not sure that
> would work.
>
> Has anyone had any experience doing this? I don't want to session this
> info since for each session created a duplicate of the data would be
> made.
>
> Thanks,
>
> Jason
>
> ==================================================================
> =========
> 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
>
===========================================================================
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