This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Implicit Objects scope , lifetime and accessibility

 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

In the JSP specification some implicit object's ( response, pageContext, out, config, page, exception) scope is definded as page. I am little bit confused about this. As the JSP is running in more than one thread processing multiple request in multiple session, it will use the same page, config and other objects. Aslo from the JSP spec., I understand that the JSP page ( implementation class ) have only one instance in the container for most general cases. The references for these objects are stored in pageContext and also available through the scripting language variables. Is it means that these objects are available through pageContext when these are not in scope? If available what are the values for these objects.

Any further clarification on the life-time and scope of these implicit objects?


Thanks
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Any Answer please ?

Thanks
 
Ranch Hand
Posts: 34
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you are confusing the local variables which names are the one you gave with the objects they refer to.

Imagin a HttpServletRequest instance. Sure, it has a request scope and not a page scope. But the servlet container creates a variable which name is "request" and stores its content in the page scope. It's a kind of pageScope.setAttribute("request", request).

I hope it will help.
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure this answers your question.

See HFS p.295

It shows how these implicit vars translate into servlet code. Notice page=this; the var page is local, but "this" is the instance of the servlet.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic