aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Difference between Page and PageContext Implicit object 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 Page and PageContext Implicit object" Watch "Difference between Page and PageContext Implicit object" New topic
Author

Difference between Page and PageContext Implicit object

sarang bharambe
Ranch Hand

Joined: Apr 01, 2005
Posts: 40
Hello Ranchers,

Can anyone explain the difference between Page and PageContext implicit object that are available to the JSP?

Regards,
Sarang Bharambe


SCJP 1.4 (86%)<br />SCWCD 1.4 (86%)<br />----------<br />If You dont succeed at first time,call it Version 1.0 !!!
Gaurav Gambhir
Ranch Hand

Joined: Mar 04, 2006
Posts: 254
page
The implicit variable page is of class java.lang.Object and it refers to instance of generated servlet. It is declared as
Object page=this
Consider
<%= page.getServletInfo() %> will give Error
getServletInfo() is not a method of java.lang.Object
<%= ((Servlet)page).getServletInfo() %> is valid

pageContext
pageContext variable is of type javax.servlet.jsp.PageContext. The PageContext class is the abstract class and JSP engine vendor provides its concrete subclass.
�Store reference to implicit objects,
�Provide method to get and set attributes in different scopes.
�Provide convenience methods for transferring request to other resources in web application.
PageContext.forward(�other.jsp�);
Nidhi Garg
Greenhorn

Joined: Jun 19, 2009
Posts: 21
pageContext has some usefu page attributes , access to request , response, session as well as JspWriter (referenced by out). It can be used for including another URLs content or for forwarding like: pageContext.forward("other.jsp");
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between Page and PageContext Implicit object