What is the difference between servletcontext and pagecontext?

Showing Answers 1 - 6 of 6 Answers

sanjit kumar koley

  • Nov 14th, 2006
 

ServletContext: Gives the information about the container. PageContext: Gives the information about the Request

  Was this answer useful?  Yes

delindia fathima

  • Dec 6th, 2006
 

There is only one servletcontext for a web application, where as there is only one pagecontext for a page.servlet context is an interface whereas pagecontext is an abstract class.

A PageContext instance provides access to all the namespaces associated with a JSP page, provides access to several page attributes, as well as a layer above the implementation details. Implicit objects are added the pageContext automatically. whereas servlet context defines a set of methods that a servlet uses to communicate with its servlet container, for example, to get the MIME type of a file, dispatch requests, or write to a log file.

venkat soma

  • Jan 3rd, 2007
 

for whole web application, there will be one ServletContext object.

But for every page, there will be its own PageContext object.

  Was this answer useful?  Yes

servletcontext ==> One per webapp. Accessible by all Jsp's servlets across the webapplication.


pagecontext ==> Is to retrieve the attributes from all of scope. One use this object when you dont know 
which scope a particular attribute is in? So this object scan all of the scopes and gives you the object.


Cheers

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions