It's not a secret anymore!*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "getInitParamater() method" Watch "getInitParamater() method" New topic
Author

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 ?

Sam
suresh thallam
Greenhorn

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
<servlet><init-param><param-name>user</param-name><param-value>suresh</param-value></servlet>

Suresh
Mathew Sam
Ranch Hand

Joined: Dec 19, 2001
Posts: 124
Thanks Suresh
Sam
 
jQuery in Action, 2nd edition
 
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