A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Joined: Dec 05, 2007
Oct 22, 2008 16:59:00
In my app there are more then 3
. And I need to call something like the init() method to config somethings.
But I think the init is only for its
, how can I do some init like so that all servlets can use the things I will start in it?
Author and ninkuma
Joined: Jan 10, 2002
Oct 22, 2008 17:22:00
Research the concept of a
Asking smart questions
Books by Bear
Joined: Oct 24, 2008
Oct 24, 2008 04:16:00
First write a Listener class which implements ServletContextListener. and
use setAttribute(var,val) and this attribute you can use in all servlets.
otherwise, use context-param tags in web.xml
That also works same.
Have you checked out
subject: init options
How to obtain hostname during servlet init
JSF + Hibernate - startup
init and constructor in servlet
init() and init(conf)
question on implicit objects in EL?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015