Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFSJ Page 471:

 
amarshi mohanty
Ranch Hand
Posts: 110
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

page 471 says:

<%@ page isErrorPage=”true” %>
<html><body>
<strong>Bummer.</strong>

You caused a ${pageContext.exception} on the server.


</body></html>

and then is explainns:
"Note: the exception implicit object is available ONLY to error pages with an explicitly-defined page directive:
<%@ page isErrorPage=”true” %>
In other words, configuring an error page in the DD is not enough to make the Container give that page the implicit exception object ".



I am not getting how Container gives the "exception " object?

thanks
Amarshi
 
Ankit Garg
Sheriff
Posts: 9495
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
amarshi when you post HTML in your message, check the "Disable HTML in this message" checkbox so that your post doesn't get screwed up.

When you set the isErrorPage="true", then the container created a scripting variable called exception in the generated servlet of the JSP page. If you don't specify the isErrorPage="true", you can still use the exception object using EL (as in your code) or pageContext scripting variable...
 
amarshi mohanty
Ranch Hand
Posts: 110
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank Ankit..
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic