what is the difference between servlet config and servlet context? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is the difference between servlet config and servlet context?

19th Mar 2017, 11:59 AM
Somnath Ghosh
Somnath Ghosh - avatar
3 Answers
+ 1
Servletconfig specified for a particular servlet and unknown to other servlets in application. ServletContext specified for an entire application outside of any particular servlet and available to all servlets within that application.
19th Mar 2017, 1:41 PM
Sergey L.
0
sergey.....if there are two servlet...if i want to use servlet config for one servlet... how web.xml will understand which servlet has used config
19th Mar 2017, 2:03 PM
Somnath Ghosh
Somnath Ghosh - avatar
0
You can pass parameters to a servlet from web.xml. Example code: <servlet> <servlet-name>yourServletName</servlet-name> <servlet-class>your.package.ServletClass</servlet-class> <init-param> <param-name>paramName</param-name> <param-value>value<param-value> </init-param>
19th Mar 2017, 2:25 PM
Sergey L.