wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes difference between application and pageContext implicit objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "difference between application and pageContext implicit objects" Watch "difference between application and pageContext implicit objects" New topic
Author

difference between application and pageContext implicit objects

Krupa Eng
Ranch Hand

Joined: Sep 05, 2003
Posts: 60
What is the difference between the following 2 JSP implicit objects application and
pageContext


Krupa
Faisal Khan
Ranch Hand

Joined: Jun 29, 2003
Posts: 285
The application object refers to the ServletContext, i.e the environment in which the JSP pages belong, this does not have access to request, response, sesseion etc.
pageContext is not in the servlets and has been added to JSP for convenience, according to SCWCD Study Kit, it has 3 main reasons for being:
1. It stores referece to the implicit objects.
2. Provides convenience methods to get and set attributes in different scopes, e.g. I have the following in my Tag: String corporateID= (String)pageContext.getAttribute("corporateID", PageContext.SESSION_SCOPE);
3. Provides convenience methods for transferring requests to other resources in web application (include and forward)
hth


The secret to creativity is knowing how to hide your sources.
Krupa Eng
Ranch Hand

Joined: Sep 05, 2003
Posts: 60
Thanks for the prompt reply
 
 
subject: difference between application and pageContext implicit objects