luehe 2003/03/24 09:35:26 Modified: jasper2/src/share/org/apache/jasper/compiler Generator.java jasper2/src/share/org/apache/jasper/runtime JspRuntimeLibrary.java Log: Implemented 'exception' variable clarification: The 'exception' implicit scripting language variable is set to value of the 'javax.servlet.error.exception' request attribute value if present, otherwise to the value of the 'javax.servlet.jsp.jspException' request attribute value (for backwards compatibility for JSP pages pre-compiled with a JSP 1.2 compiler). Revision Changes Path 1.176 +4 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.175 retrieving revision 1.176 diff -u -r1.175 -r1.176 --- Generator.java 21 Mar 2003 00:43:57 -0000 1.175 +++ Generator.java 24 Mar 2003 17:35:26 -0000 1.176 @@ -539,8 +539,7 @@ out.printil("HttpSession session = null;"); if (pageInfo.isIsErrorPage()) { - out.printil("Throwable exception = (Throwable) request.getAttribute(\"javax.servlet.jsp.jspException\");"); - out.printil("request.setAttribute(\"javax.servlet.error.exception\", exception);"); + out.printil("Throwable exception = org.apache.jasper.runtime.JspRuntimeLibrary.getThrowable(request);"); } out.printil("ServletContext application = null;"); 1.18 +22 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java Index: JspRuntimeLibrary.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- JspRuntimeLibrary.java 6 Mar 2003 20:21:46 -0000 1.17 +++ JspRuntimeLibrary.java 24 Mar 2003 17:35:26 -0000 1.18 @@ -100,6 +100,11 @@ * @author Shawn Bayern */ public class JspRuntimeLibrary { + + private static final String SERVLET_EXCEPTION + = "javax.servlet.error.exception"; + private static final String JSP_EXCEPTION + = "javax.servlet.jsp.jspException"; protected static class PrivilegedIntrospectHelper implements PrivilegedExceptionAction { @@ -128,6 +133,20 @@ bean,prop,value,request,param,ignoreMethodNF); return null; } + } + + /** + * Returns the value of the javax.servlet.error.exception request + * attribute value, if present, otherwise the value of the + * javax.servlet.jsp.jspException request attribute value. + */ + public static Throwable getThrowable(ServletRequest request) { + Throwable error = (Throwable) request.getAttribute(SERVLET_EXCEPTION); + if (error == null) { + error = (Throwable) request.getAttribute(JSP_EXCEPTION); + } + + return error; } public static boolean coerceToBoolean(String s) {
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]