Hey All,

I am a bit confused in J2EE (and tomcat) concerning the best spot to do a bunch of 
initializations, and other startup code.

Now, in Coldfusion you have the Application.cfm file which gets run on every request, 
thus you can load up the application scope (if
its unitialized) or recycle it periodically with data/objects (which is great for 
cache queues).

In jsp, I would like to have a  jsp file run on initialization so that I can offer 
that file as a jsp based application
initialization file (using custom tags to load up the application scope and even 
session and other goodies like internationalization
bundles etc).

It seems the best spot would be a ServletContext listener that would, on startup, fire 
a request to the Application.jsp file ... but
this does not seem possible given the ServletContextListener interface (or is it)?

In general, I haven't found much info on best practices for setting up the initial 
state of an application.  If I wanted load up
some JNDI entries on startup, where is the best place to do this (in a 
ServletContextListener perhaps?) ?  And for some application
attributes, same question.  And to initialize the session for a user?

I really like the Coldfusion concept of the Application.cfm file since you can do all 
your state checks there, and then all your
scripts/servlets can expect the web application state to be well managed.  Its also a 
great spot for loading in internationalization
resource bundles.

It would be even better to have a more fine grained Application.jsp file that would 
fire on initialization and vice versa, and for a
few other significant application events.  I don't particularly like putting a lot of 
params in the web.xml file since this can
complicate migrations and makes it a bit un-programmatic.  I also like having simple 
custom tags loading the application and session
scope so that you can glance at one script for the app and see what is in those scopes 
by default, rather than having servlets doing
their own thing and promoting decentralized scope processes.

Any ideas?

Thanks,
John.



--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to