Alexander Yavorskiy wrote:

> Hi,
> The entry point for my JSP/Servlet application is a single servlet. Its
> purpose is to instantiate and initialize a few beans that should persist for
> the lifetime of the app. I would like to make these beans available to all
> JSP pages through the USEBEAN tag with an application lifespan. Does anyone
> know a syntax for instantiating such beans in a servlet  such that USEBEAN
> tag can locate and reference them?
>
> Thanks,
> Alex
>

The official way to do this is to store attributes in the servlet context
object, like this:

    MyBean bean = new MyBean(....);
    getServletContext().setAttribute("mybean", bean);

and this bean will be visible under id "mybean" with application scope in your
JSP pages.

Craig McClanahan

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to