• Post Reply Bookmark Topic Watch Topic
  • New Topic

Jsp implicit objects

 
Gurukant Desai
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which implicit object is NOT available to the jsp page?
<%page isErrorPage='false' session='false' isThreadSafe='false' %>
1) page
2) pageContext
3) session
4) exception
I have confusion between opinion 3 and opinion 4. Please guide.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35709
408
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought they both were. What exam/mock is this question from?

Also note that it is bad practice to reference any of those implicit objects directly. Using expression language, you reference objects in the session not the session per se.
 
Gurukant Desai
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne for your guidance.

This question is from my company's exam.
 
Chandrajeet Yadav
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gurukant Desai wrote:which implicit object is NOT available to the jsp page?
<%page isErrorPage='false' session='false' isThreadSafe='false' %>
1) page
2) pageContext
3) session
4) exception
I have confusion between opinion 3 and opinion 4. Please guide.


Ans: 'exception'.
Reason: implicit object 'exception' is accessible only in error page(page configured for 'error page')
 
Stefan Evans
Bartender
Posts: 1822
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I realise that this is a zombie thread recently resurrected, but just to follow up on the answer from Gurukan

When isErrorPage is false it does not create the implicit variable: exception

Why is the answer not "3" session?
The page directive also specifies session='false'

Surely by the same logic, the session object is available only in a page configured for a session? 

Here is a test page.


Compare what happens with various values of true/false for the appropriate page directives to see what is happening.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!