• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between application and pageContext implicit objects

 
Krupa Eng
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between the following 2 JSP implicit objects application and
pageContext
 
Faisal Khan
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Krupa Eng
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the prompt reply
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic