Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

type of exception implicit object??

 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per JSP specification....

JSP.1.4.3 Using JSPs as Error Pages
A JSP is considered an Error Page if it sets the page directive’s isErrorPage
attribute to true. If a page has isErrorPage set to true, then the “exception” implicit
scripting language variable (see Table JSP.1-7) of that page is initialized. The
variable is set to the value of the javax.servlet.error.exception request attribute
value if present, otherwise to the value of the javax.servlet.jsp.jspException request
attribute value
(for backwards compatibility for JSP pages pre-compiled with a
JSP 1.2 compiler).

I dont understand the meaning of bold line. Is that means the type of exception object weather javax.servlet.error.exception OR javax.servlet.jsp.jspException ???

Please help, i am totaly confused
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont understand the meaning of bold line. Is that means the type of exception object weather javax.servlet.error.exception OR javax.servlet.jsp.jspException ???

The "exception" implicit object's type is Throwable. You can deduce that both the value identified by "javax.servlet.error.exception" and the one identified by "javax.servlet.jsp.jspException" will hold anything extending Throwable.
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not getting it.. sorry
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the container sets the "exception" implicit objects, it looks for a request attribute called "javax.servlet.error.exception". request.getAttribute("javax.servlet.error.exception");, and sets the returned Object into "exception". If the attribute called "javax.servlet.error.exception" does not exist, it will look for another one called "javax.servlet.jsp.jspException", and do the same. You can deduce than the type of "exception" will be either the same as the value returned by request.getAttribute("javax.servlet.error.exception"), or by request.getAttribute("javax.servlet.jsp.jspException"). But in any case, "exception" will be of type Throwable.

(For the exam, if you know that "exception" is a Throwable, it's enough)
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe Verré wrote:When the container sets the "exception" implicit objects, it looks for a request attribute called "javax.servlet.error.exception". quote]

that means container make these attribute available called javax.servlet.error.exception AND javax.servlet.jsp.jspException Am i right??

if that is the case what are the scenario when cotainer creates javax.servlet.error.exception OR javax.servlet.jsp.jspException


Sorry if this seems a dumb question
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry if this seems a dumb question

There's no dumb question

if that is the case what are the scenario when cotainer creates javax.servlet.error.exception OR javax.servlet.jsp.jspException

I don't know. From the spec, it seems that javax.servlet.jsp.jspException will be used for backwards compatibility for JSP pages pre-compiled with a JSP 1.2 compiler. Looking into the JSP 1.2 specification may give you more details.
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actualy I tried to find the more details from JSP 1.2 specification already. but there is no much detail about it.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My advice : forget about it for the moment, and concentrate on more important things for the exam You can spend more time digging into it after you pass.
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok christophe, I appreciate your advice and I am going to follow it

Thnaks Buddy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic