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 tools used in your project , How to ask the answer this question

1591


What is difference between sendredirect and requestdispatcher?

492


How can we prevent implicit session creation in jsp?

531


What is a output comment?

564


Which one is correct order of phases in jsp life cycle?

631






What is jsp language?

496


What happens when a page is statically included in another jsp page?

561


What is context in web application?

493


Why we use jsp instead of html?

480


How to comment out jsp code?

513


How are the jsp requests handled?

513


What do you know about pagecontext and what are the advantages of using it?

550


Can you call jsp from servlet?

522


How to deactivate el usage on jsp?

526


What is request scope in jsp?

520