• Post Reply Bookmark Topic Watch Topic
  • New Topic

true OR false???

 
mocca az
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JSP, session is implicit object and it is set to true by default. That means that i can access session information by just using "session". Now if i set session object to "false", then i can't use "session" anymore, but i have to declare object variable HttpSession session; in order to create new session or whatever i need to do with it.
1. Is this true?
2. Is same rule applied to all implicit objects?
3. Anything else i need to know about this.
Thank you,

mocca az
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The session object you get implicity in JSP scriptlets, cannot be 'set' to true or false. It is an object that can be nulled, but this would be unwise. Why would you want to do this? To retrieve the session object again, it is not a simple matter of simply making a new HttpSession object. The JSP gets the session from it's container.

To examine how the implicit objects work, make a very simply "hello world" JSP and view the 'translated' java source file for the servlet. (the one that gets made from the JSP). You will see how session, application, out, request, response (and the other implicit ones I forget) are made.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!