Kevin Burton wrote:

> This is is a really good question.  From what I have read of the spec I
> don't think there is one.
>
> I assume it could be accompolished by sending the client to a single
> "session/application start" page which then redirects them to a page or
> pages that assume the session is started.  But this is kind of kludgy
> and requires an HTTP redirect which means extra latency (BAD LATENCY,
> BAD!)
>
> I have to write an application that has this functionality.  Will see.
>

In a JSP/servlets context, application-scope variables are stored in the
ServletContext.  When I need application-scope variables to be initialized when
the server is started up, I do the following:

* Create a servlet that initializes the shared
  variables in its init() method, and stores
  them with a call to:
        getServletContext().setAttribute("name", object);

* Instruct my servlet engine to run this servlet
  at startup time (not currently possible with
  the JSWDK servlet engine, but most others
  have a configuration parameter for this).

* Don't map this servlet to any URI path or
  filename extension, so there's no way to
  accidentally access it from a client.

* Optionally, put cleanup stuff in the destroy()
  method of this servlet, which will get executed
  when this servlet is shut down (normally only at
  the end of the servlet engine's life, but you cannot
  really count on this).

In JSP 1.1 (based on the Servlet 2.2 API spec), you will also be able to
initialize things in the application scope with settings in the application's
deployment descriptor.

Craig McClanahan


>
> "Joseph, Sajeev" wrote:
> >
> > Does anyone know if there is a "global.jsa" in JSP 1.0, similar to the
> > "global.asa" in ASP?
> >
> > Thank you,
> > Sajeev Joseph
> >
> > ===========================================================================
> > 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".
>
> ===========================================================================
> 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".

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