• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PreInitialization of servlets

 
Vishal Dhingreja
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

what do you mean preinitialization of servlets ? What is it used for & how can it be acheived

Regrds
Vishal
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
READ THE JAVADOCS and the servlet API
The init method will be called by the servlet container before any request is processed.
Download the servlet API and keep it handy - here is a good place to start.
Bill
 
Vishal Dhingreja
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi William

Sorry If that question sounded lowsy. Though I don't boast of great exposure in coding with Servlets API ,I very well understand the meaning of
Initialisation of servlets & quiet conversant with the servlet lifecycle.

What i wanted to ask was if there is something before initilisation.

If PRE-Initilisation * Initilisation mean the same then sorry for creating this thread

Bye
Vishal
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, approaching it from the point of view of "what happens before a servlet gets initialized" - you can get some idea by watching Tomcat startup message in a command prompt. Roughly speaking,
1 - the server.xml is read and the basic connectors, loggers, filters, etc are configured.
2 - the default web.xml is read and servlets defined there with load-on-startup numbers are instantiated and init()ed.
3 - Tomcat goes through all the "web applications" that it knows about, reading the web.xml for each one - here is where servlet initialization parameters for your application servlets are picked up. Any servlets defined with load-on-startup get init()ed

A failure at any point in the above could prevent your application servlet from ever getting initialized, so I guess we could call that pre-initialization.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic