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

What are the life-cycle methods for a jsp?

489


How can I declare methods within my jsp page?

520


Why is it not necessary to configure standard jsp tags in web.xml?

497


Why do we use jsp?

494


How do I save a jsp file?

502






Why is it that JComponent have add() and remove() methods but Component doesn’t?

502


What is the page directive is used to prevent a jsp page from automatically creating a session?

550


Can I declare a java class in jsp?

495


What is jsp technology?

525


What is jsp language?

490


How to connect jsp and java file?

466


HOW CAN WE COMPARE TWO PDF FILES USING JSP ?

2375


How do I mix jsp and ssi #include? What is the difference between include directive & jsp:include action?

509


Can jsp run without server?

468


What information is needed to create a tcp socket?

510