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

Give a sample jsp configuration in the deployment descriptor.

698


How to create menu in jsp with example?

684


How jsp is compiled?

642


What are the standard actions available in jsp?

734


Why session is used?

643


What are the main tags in jsp?

682


Give the syntax for jsp comments.

666


What are page directives?

720


Which one is better jsp or servlet?

688


mention the three important tags used in the development of jsp bean.

671


Is jsp server side scripting language?

761


Explain the various scope values for tag.

695


How to send data from jsp to jsp?

694


What is contextpath?

684


What is a scriptlet in jsp and what is its syntax?

694