>>> I have an object that is very expensive in terms of time (it reads in
>>> an XML mapping file).
[quoted text clipped - 10 lines]
> place it in the web application's context while the shutdown even would
> trigger cleanup code.
Regarding application context instead of singleton: then in general
that is a very bad design because all the code using it becomes
tied to being used in web app context. If it is only to be used
in JSP pages then no problem, they are already tied to web app
context.
Regarding ServletContextListener instead of startup servlet: fine.
Arne
Robert Klemme - 28 Jan 2007 10:22 GMT
>>>> How do I load this object into memory once - and once only - when
>>>> the server starts? How do I access this object in my standard JSP code?
>> A more proper solution is to implement the interface that listens to
>> application events. The startup event would create that object and
[quoted text clipped - 6 lines]
> in JSP pages then no problem, they are already tied to web app
> context.
That's the exact reason why I proposed this approach here: OP asked for
access from JSP code. :-)
Kind regards
robert