Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2007

Tip: Looking for answers? Try searching our database.

tomcat :: Listener for my own class (global access to class)

Thread view: 
devphylosoff - 26 Sep 2007 21:28 GMT
hi

I have one servlet with init() method which initialize object of my
own class.

that's ok if I use this object from only one servlet.
but how change it - add Listener and have access to object from all
servlets.
moreover do not edit any of tomcat files, only project files.

thanks
Juha Laiho - 29 Sep 2007 21:37 GMT
devphylosoff <devphyl@gmail.com> said:
>I have one servlet with init() method which initialize object of my
>own class.
>
>that's ok if I use this object from only one servlet.
>but how change it - add Listener and have access to object from all
>servlets.

Your init() places the object to application context, so it will be
available through application context to all other servlets needing it;
just take care that the servlet initializing this class is something
that it loaded on webapp startup (web.xml init-on-startup, if I recall
correctly).
Signature

Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
        PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.