This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes getInitParamater() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "getInitParamater() method" Watch "getInitParamater() method" New topic

getInitParamater() method

Mathew Sam
Ranch Hand

Joined: Dec 19, 2001
Posts: 124
What is the difference between getinitParameter() method in ServletContext and in ServletConfig ?
Can we use either of this to get the value of init patrametes ?

suresh thallam

Joined: Sep 08, 2002
Posts: 2
by using context.getInitParameter() we can access context-wide initialized parameters. These parameters are defined in web.xml using <context-param> tags. These values are accessiable to all the servlets and jsps present in the context.
By using config.getInitParameter() we can access the initialization parameters defined for that servlet only. These are specific to that servlet only. These are defined in web.xml like this

Mathew Sam
Ranch Hand

Joined: Dec 19, 2001
Posts: 124
Thanks Suresh
I agree. Here's the link:
subject: getInitParamater() method
Similar Threads
NX: When should I throw DuplicateKeyException?
Changin font in a JTextArea
Finalization Method
Sharpen your Pencil - Page 323 in HFEJB
garbage collection