Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing a JSP's impleicit object pageContext in a Servlet?

 
Alok Pota
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way I can get access to a JSP's built-in variable
pageContext in a servlet? Also is there a difference between
the implciti object page & pageContext
 
Madhu Juneja
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Jsp is converted to a servlet. Hence this pageContext is very much accessible in the servlet (in the service method as it a local variable to the service method)
page is equivalent to 'this' variable and pageContext refers to any context that this current page references for eg pageContext has various methods such as getServletConfig(), getSession(), getOut(), getServletContext() methods that a developer can make use of.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Alok Pota:
Is there a way I can get access to a JSP's built-in variable
pageContext in a servlet?

In a servlet there is no PageContext (unless it's a compiled JSP of course). What do you find in PageContext that you cannot find in HttpRequest or ServletContext?
- Peter

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic