Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

servlet init param and contect param

Hi,

I am reading below link on servlets.

http://tutorials.jenkov.com/java-servlets/web-xml.html

Waht are the cases or scenarios we need to pass init-param, context params to a servlet. I am not clear on that concept which was being used even in spring framework also.
How to know if to pass single servlet or to all servlets?
Please advise
Avatar of gurpsbassi
gurpsbassi
Flag of United Kingdom of Great Britain and Northern Ireland image

You are getting confused between init params that you define on a single servlet through web.xml and context params that are defined for the whole web application context.

init params are used by servlets to initialise themselves in the init() method.

Context params are used to set parameters on the entire web application so any servlet can access them.
Avatar of gudii9

ASKER

What are practically examples where we use both?
ASKER CERTIFIED SOLUTION
Avatar of gurpsbassi
gurpsbassi
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial