aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Confused regarding isErrorPage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Confused regarding isErrorPage" Watch "Confused regarding isErrorPage" New topic
Author

Confused regarding isErrorPage

Radoslaw Sztando
Ranch Hand

Joined: Mar 11, 2004
Posts: 40
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


Regards,
Radek Sztando
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9313
    
  17

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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Radoslaw Sztando
Ranch Hand

Joined: Mar 11, 2004
Posts: 40
I used EL:

Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
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

Joined: Feb 22, 2007
Posts: 285
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

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.


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Confused regarding isErrorPage