my dog learned polymorphism*
The moose likes Servlets and the fly likes starting servlet when application  loads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "starting servlet when application  loads" Watch "starting servlet when application  loads" New topic
Author

starting servlet when application loads

JohnV Varghese
Greenhorn

Joined: Oct 09, 2003
Posts: 7
My problem is that I want a servlet to be loaded when my application is accessed the first time.
The application starts through a login page.
hence the servlet should be loaded AFTER the login page has been requested the first time
I am using tomcat 4.1.27
Pls help
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
hence the servlet should be loaded AFTER the login page has been requested the first time
AFTER, or before?
Anyways, I think what you're after is the tag <load-on-startup> in web.xml. It tells the servlet container to load and initialize the servlet when the container starts up. Have a look at it in the servlet specification.
[ November 02, 2003: Message edited by: Andres Gonzalez ]

I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Celina Paul
Greenhorn

Joined: Nov 01, 2003
Posts: 16
A servlet would be loaded when it is accessed for the first time..unless it has been specified as one of the "load-on-startup" servlets in the deployment descriptor as specified earlier.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: starting servlet when application loads