Jason Lee wrote:
>
> 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.

Beans stored in the session scope, using <jsp:useBean> in a JSP page,
can be accessed in a servlet through the ServletContext.getAttribute()
method. The attribute name is the value you used for the id attribute
in the <jsp:useBean> action.

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
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