Use pageContext to reach JSP implicit variables in JSTL expressions
To clarify, here is the code i tested (yes, i tested it!)
TestClass1.java
-----------------------------------------
package com.test;
public class TestClass1 {
private int i;
public void setI(int i) {
this.i = 100 / i; /*Arithematic exception when i = 0*/
}
public int getI() {
return i;
}
}
test.jsp
-----------------------------------------------
<%@ page errorPage='myerror.jsp'%>
<html>
<jsp:useBean id='myClass' class='com.test.TestClass1' scope='request'/>
<%
int i =0;/*Note here*/
%>
<jsp:setProperty name='myClass' property='i' value='<%=i%>'/>
<jsp:getProperty name='myClass' property='i'/>
<html>
myerror.jsp
-----------------------------------------------
<%@ page isErrorPage="true" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
Hi! <c
ut value="${pageContext.exception}"/>
Hope, it helps