Win a copy of Spring in Action (5th edition) this week in the Spring 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

implicit objects in jsp  RSS feed

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are implicit objects like request, response, session, out, Page Context etc available for use.
These objects can be used directly and instantiation takes place automatically. If a method by the same name is existing in both the classes, which one would be invoked eg session.getAttribute(String name) is in Session and PageContext both the classes. session is reference which can be used with any object. So in this situation when
${session.getAttribute("name")} is used in jsp, which class will be instantiated , Session or PageContext ? session is reference or classname ? I tend to assume that session is referance name in here because it starts with lower case "s". Classname starts with uppercase "S". If session is classname in here, why is it starting with lower case which is contrary to convention.

Please explain this in detail , how does instantiation of implicit objects work.

thanks
 
Marshal
Posts: 67164
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Implicit objects are instances, not classes.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And they're already instantiated by the time control gets to your JSP.
 
nirali shah
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even an instance has to be created.

Session session = new Session();

this creates an instance of Session object and session is the reference for this object. After this we can access properties of Session. If Session and PageContext have a method by the same name, then how to access it ? How would I know, an instance of Session is referred by what name and an instance of PageContext is referred by what name ?

As David replied that these objects are alredy instantiated. What reference is pointing to these instances ?

 
Bear Bibeault
Marshal
Posts: 67164
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
session and pageContext, respectively.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!