aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Diff between page and pageContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Diff between page and pageContext" Watch "Diff between page and pageContext" New topic
Author

Diff between page and pageContext

Sairam Ramakrishnan
Greenhorn

Joined: Mar 27, 2004
Posts: 13
Hi,

May be this is a simple question.

Can someone tell me the difference between page and pageContext in JSP.

I understand that we get the reference of all the implicit object from pageContext but why does it have an setAttribute() method ? and what is the scope ?

Many thanks.

-Sairam.


************<br />SCJP 1.4
Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
Hi,
Using pageContext object you can set attribute in one of the scopes page, request, session or application. These scopes are defined as constants in PageContext class and you can pass the scope to the method of setAttribute() to specify in which scope you need to bind the value.


Rizwan
SCJA, SCJP, SCWCD, SCBCD, SCDJWS.
Priyank Nautiyal
Greenhorn

Joined: Oct 18, 2005
Posts: 16
Hi,
Your 2nd question has already been answered by Rizwan, so i'll answer your 1st question.
The page object in JSP refers to the servlet that is generated after translation of a JSP i.e. it is same as the "this" keyword used in a Java file, while pageContext is a page scope object similar to request,session and application. So it is the pageContext object which refers to the page scope and not the page object as we might tend to think.


Cheers,<br />Priyank<br />SCJP-96%,SCWCD-85%
Sairam Ramakrishnan
Greenhorn

Joined: Mar 27, 2004
Posts: 13
Thank you very much.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Diff between page and pageContext
 
Similar Threads
Implicit objects in JSP
the difference...
difference between PageContext and Page object
pageContext
doubt in implicit objects