Are application, pageContext and object of ServletContext
same or not?

Answer Posted / farhaananwar

application and object of ServletContext are same. In jsp
page application implicit variable represents object of
ServletContext but pageContext represent object whose super
class is SerlvetContext. the class of PageContext has some
conviniant methods for manipulation of attributes of
different scopes. These methods are findAttribute, get/set/
removeAttribute that accept last parameter as a int value
representing scope to which attribute pass to methods
belongs.
The PageContext has integral contant value for showing
scopes which are PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE
and APPLICATION_SCOPE. These constant values are used as a
last arguement to set/get/removeAttribute methods to
indicate to which scope the attribute belong. such a methods
and consant values are not present in its super class
ServletContext.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many tags are provided by jstl?

714


What is jsp include tag?

698


What is difference between java and jsp?

694


How can we avoid direct access of jsp pages from client browser?

845


Perform a browser redirection from a jsp page?

751


Is it possible to share an httpsession between a jsp and ejb? What happens when I change a value in the httpsession from inside an ejb?

723


What is a session in web?

719


Is jsp platform dependent?

691


What is an api with example?

815


Which tag is used for error handling in jsp pages?

635


How do I mix jsp and ssi #include?

759


How to find out the name of the http method using jsp el?

746


What is jsp scriptlet?

681


What is jsp standard tag library, provide some example usage?

717


What is a page directive?

698