Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confused regarding isErrorPage

 
Radoslaw Sztando
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I read page directive specification and it says:

isErrorPage="true | false"
Whether the JSP file displays an error page. If set to true, you can use the exception object in the JSP file. If set to false (the default value), you cannot use the exception object in the JSP file.


However I prepared error page without isErrorPage directive and I still can use exception object in it.
I tried both ways of configuring it as error page (in DD and using errorPage page directive in 'faulty' jsp). I also tried setting isErrorPage implicitly to "false".
It still works!

Is it a matter of Container? I use Tomcat 6.0

 
Ankit Garg
Sheriff
Posts: 9528
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I prepared error page without isErrorPage directive and I still can use exception object in it.

How did you use the exception object basically?? I saw the source code of one of the servlet file generated by tomcat 6 for a JSP page, and the exception object was not created by tomcat in the .java file...
 
Radoslaw Sztando
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used EL:

 
Chinmaya Chowdary
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Radoslaw.

Here exception object is accessing through EL implicit 'pageContext' Object. PageContext has getException() method. It is possible to access exception object through EL syntatx like,
 
raj malhotra
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I also verified that if i remove isErrorPage="true" from the error page and i use jsp expression



to access the exception object i am getting jsp compilation error.

But i can use


to access the exception object.

This looks confusing .
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This looks confusing .

Not really. If isErrorPage="true" is not set, the implicit "exception" variable is not set by the container. You'll have an error if you try to access it. ${pageContext.exception} or <%=pageContext.getException()%> is calling the getException() method of the PageContext class. It's just like calling any kind of method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic