The moose likes Servlets and the fly likes How does init(ServletConfig) work? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How does init(ServletConfig) work?" Watch "How does init(ServletConfig) work?" New topic

How does init(ServletConfig) work?

Jian Yi
Ranch Hand

Joined: Feb 01, 2002
Posts: 127
Does it read a file named as "configFile" and sets the ServletConfig?
Sanjeev Kaushik
Ranch Hand

Joined: Aug 01, 2002
Posts: 105
It reads the deployment file of your component.
For example when you deploy a servlet in Tomcat, deployment file is web.xml and it reads all the key/values from this file.
Hope it helps.

Sanjeev Kaushik
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
It is not just Tomcat - ALL Java servlet engines must read web.xml to define the properties of a web application. The DTD for web.xml is a standard.
Higher level definitions are up to the vendor - for example, Tomcat uses server.xml, which is not a standard.
I agree. Here's the link:
subject: How does init(ServletConfig) work?
It's not a secret anymore!