| Author |
pageContext.exception is not executing
|
Gowher Naik
Ranch Hand
Joined: Feb 07, 2005
Posts: 643
|
|
start.jsp errorPage.jsp web.xml when i run start.jsp output is pageContext Error is !!!java.lang.ArithmeticException: / by zero Error is !!!java.lang.ArithmeticException: / by zero Here is my problem Now if i remove <%@ page errorPage="errorPage.jsp" %> line from start.jsp page the output is pageContext Error is !!! Error is !!!java.lang.ArithmeticException: / by zero i.e ${pageContext.exception} is not executed. why it is so? Thanks
|
 |
Sreeraj G Harilal
Ranch Hand
Joined: Apr 19, 2006
Posts: 310
|
|
Its working fine in my computer. Both error messages are same.
|
SCJP 5.0<br />SCWCD 1.4<br />Preparing for <b>SCEA</b>.<br /><b>"I prefer an interesting vice to a virtue that bores."</b>
|
 |
Gowher Naik
Ranch Hand
Joined: Feb 07, 2005
Posts: 643
|
|
i am using Tomcat 5.0 Operation system is windows 2000 professional.
|
 |
Sreeraj G Harilal
Ranch Hand
Joined: Apr 19, 2006
Posts: 310
|
|
I am also using Tomcat 5.5. I think its your browser problem. Use Mozilla Firefox instead of Internet Explorer.
|
 |
Gowher Naik
Ranch Hand
Joined: Feb 07, 2005
Posts: 643
|
|
|
i am using Mozilla Firefox
|
 |
Gowher Naik
Ranch Hand
Joined: Feb 07, 2005
Posts: 643
|
|
|
i also tried Internet Explorer but it is not displaying.
|
 |
Sayak Banerjee
Ranch Hand
Joined: Nov 28, 2006
Posts: 292
|
|
|
Do you have a DD error-page elemnt as well directing the container towards the error-page? Otherwise how does it go to the error page when you remove <%@ page errorPage="errorPage.jsp" %> ...?
|
Turn on, tune in, drop out.
|
 |
Gowher Naik
Ranch Hand
Joined: Feb 07, 2005
Posts: 643
|
|
i have already configured errorpage in DD
|
 |
Sayak Banerjee
Ranch Hand
Joined: Nov 28, 2006
Posts: 292
|
|
|
I'm gettin' the same thin'....lemme see if I can figure it out
|
 |
Sayak Banerjee
Ranch Hand
Joined: Nov 28, 2006
Posts: 292
|
|
Ok...here's the explanation...not satisfactory...but at least you know what's happening Irrespective of whether you use the page directive <%@ page errorPage="errorPage.jsp" %> in test.jsp or not, important thing is that you have included the page directive <%@ page isErrorPage="true" %> in errorPage.jsp which is a requirement in order to get the JSP Implicit object exception... Now, when you use the page directive <%@ page errorPage="errorPage.jsp" %> in test.jsp, the container returns the Exception associated with the errorPage.jsp since ${pageContext.exception} is actually pageContext.getException() called from errorPage.jsp...but when you don't use the directive in test.jsp, the container does not associate the exception with errorPage.jsp....I dunno why exactly this happens but I did fing the difference in method arguments(in the former case "errorPage.jsp" is passed but in the latter case it's null) passed when the container gets the pageContext implicit object....you can see it for yourself by checking the generated servlet code for test.jsp in both cases...Somethin's happenin'....not exactly sure because these methods are way too complex...BUT yeah I guess the reason why you're getting the JSP implicit object "exception" is exactly as explained above and it's mentioned in HFSJ as well(hand-written note Page 461) Hope that helps to some extent  [ December 08, 2006: Message edited by: Sayak Banerjee ]
|
 |
Sreeraj G Harilal
Ranch Hand
Joined: Apr 19, 2006
Posts: 310
|
|
Sayak what are saying. It works fine with or without <%@ page errorPage="errorPage.jsp" %>.
|
 |
Sayak Banerjee
Ranch Hand
Joined: Nov 28, 2006
Posts: 292
|
|
|
It didn't in my case....I got the exact same output as Gowher had explained earlier...I'm using Tomcat 5.0.28/Win XP....tried in Mozilla Firefox as well as Intenet Explorer....thats the reason I went for the generated servlet files for test.jsp in both cases and found the subtle differnece in them (which I pointed out)...I'm not sure if you have a better explanation for this but this is precisely what's happenin'
|
 |
 |
|
|
subject: pageContext.exception is not executing
|
|
|