Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"page" Implicit object

 
Ganesh.P Ram
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

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


Thanks in advance,
Ganesh
 
Marcelo Ortega
Ranch Hand
Posts: 528
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ganesh.P Ram
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic