This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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 8 in Action this week in the Java 8 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: 12682
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.

Java Resources at
I agree. Here's the link:
subject: How does init(ServletConfig) work?
Similar Threads
GenericServlet & ServletConfig
Multiple threads of a servlet instance and servletConfig
passing ServletContext
Why does GenericServlet implements ServletConfig?