This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark ""page" Implicit object" Watch ""page" Implicit object" New topic
Author

"page" Implicit object

Ganesh.P Ram
Ranch Hand

Joined: Dec 22, 2005
Posts: 41
Hi All,

Could anyone tell me whats the use of the "Page" Implicit object in JSPs.


Thanks in advance,
Ganesh


Ganesh
Marcelo Ortega
Ranch Hand

Joined: May 31, 2005
Posts: 519

Hi there.
The page implicit object is something which you can bind attributes to... it's another scope which JSPs can use. Don't confuse it with the pageContext object, which is an object that has convience methods like getRequest(), getSession(), getPage(), getAttribute(String name, int scope), findAttribute(), etc.
The pageContext implicit object is of type PageConetext (which extends JspContext), and the page variable is of type Object (well at least at compile time), but it actually receives a reference to the actual servlet which is executing the _jspService() method).

Regards,
Mars.
[ February 28, 2006: Message edited by: Marcelo Ortega ]

SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJD, SCEA/OCMJEA

Live life to an interface, not an implementation!
Ganesh.P Ram
Ranch Hand

Joined: Dec 22, 2005
Posts: 41
Hi,
Thanks for your reply.
So "page" is like an implicit "this" reference to the servlet.
So I can access all the instance variables and methods in that servlet..I can also pass the "this" ref to some other method.
Is my understanding right ?
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
Hi,

The page implicit object is something which you can bind attributes to... it's another scope which JSPs can use.


The "page" scoped attributes are not binded with the page Object. The page is of type Object, which holds reference of current Servlet object.

The "page" scope attributes are stored in pageContex object not in page Object.

Pl. Correct me if wrong.

Thanks


Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
 
 
subject: "page" Implicit object
 
Similar Threads
page implicit variable
jsp implicit variable
diff between Requests objects
Doubt Regarding implicit objects
Equivalent of 'this' keyword in JSP