The attribute javax.servlet.error.exception in request with dispatcher type is ERROR can always cast to java.lang.Exception type?
I take a look at the javadoc, but it doesn't mention the type must be java.lang.Exception OR java.lang.Throwable.
I am asking this question because I am handling error page. If the attribute javax.servlet.error.exception always hold Exception type so I can write code as below without worrying about ClassCastException for all cases.
Exception exception = (Exception) request.getAttribute("javax.servlet.error.exception");
Of course I can do like this:
Throwable error = (Throwable)request.getAttribute("javax.servlet.error.exception");
but my handling is on Exception type ( Not Throwable ).
Thanks!
 
     
     
    