aspose file tools
The moose likes JSP and the fly likes implicit objects in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "implicit objects in jsp" Watch "implicit objects in jsp" New topic
Author

implicit objects in jsp

nirali shah
Greenhorn

Joined: Apr 16, 2009
Posts: 24
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
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56233
    
  13

Implicit objects are instances, not classes.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

And they're already instantiated by the time control gets to your JSP.
nirali shah
Greenhorn

Joined: Apr 16, 2009
Posts: 24
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
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56233
    
  13

session and pageContext, respectively.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: implicit objects in jsp
 
Similar Threads
Correct EL expression
pageContext why?
Implicit variables and Implicit Objects
Getting session scoped variable in TagHandler class
EL implicit objects vs. JSP scripting objects