This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes init parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "init parameters" Watch "init parameters" New topic
Author

init parameters

Don Bosco
Ranch Hand

Joined: Oct 31, 2002
Posts: 108
What is the difference between the init parameters returned by methods(getInitParameter) in ServletContext and ServletConfig???


SCJP 1.4<p>Wingardium Leviosa!!
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Looking at the API, we see that ServletContext init parameters are "context wide" - in other words, apply to the entire "web application" - the api says they are created with a context-param entry in web.xml as a child of the web-app element. (I can't say I have ever seen them used, but they look useful.)
Whereas ServletConfig init parameters are specific to the servlet and come from the init-param tags in the web.xml section for a particular servlet.
Bill
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: init parameters