1)How many Servlet Context Objects Exist: For entire webapplication there will be only one ServletContext object.
2)When it gets created and who creates ServletContext ?
When your webapplication is deployed container creates it and it is
available to all Servlet and Jsp Pages.
3)What can you do with ServletContext ?
You can get Context Init params declared in web.xml with getInitParameter
method of ServletContext.
You can set Attributes and get Attributes.Means yout can store some object
using setAttribute(string,Object)
You can get that attribute from any jsp/servlet
In servlet use getAttribute
In jsp application.getAttribute
No comments:
Post a Comment