• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Confused regarding isErrorPage

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used EL:

 
Ranch Hand
Posts: 437
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
And when my army is complete, I will rule the world! But, for now, I'm going to be happy with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic