• Post Reply Bookmark Topic Watch Topic
  • New Topic

Usage of page implicit object

 
Stefan Popa
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks, i am new here and say hello to everybody in this forum.
I am wondering how the implicit object page can be (meaningful) used in scriptlets.
page is of type Object and refers to this .
So i have to cast page to something to use it.
How should i cast ? To HTTPServlet ?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At this point in time, scriptlets should no longer be used in JSP pages unless you are stuck on a version of JSP prior to JSP 2.0 for some reason.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And I'm not aware of having to cast page to anything. You'd have to cast page attributes to something useful, however.
 
Chinmaya Chowdary
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Stefan.
Cast it with javax.servlet.http.HttpServlet class inside jsp.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(I was thinking about the pageContext variable, not page.)

I still don't understand why you'd want to do this. See the following:

http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPIntro7.html

Which specifically states:
The instance of the JSP page's servlet processing the current request. Not typically used by JSP page authors.

What's your use-case for wanting to do this?!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In over ten years of working with JSPs, I've never found a use for it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!