I'm specifying the error page as a page directive in a page. When there is an exception in the JSP page, the error page is called. I want to pass a parameter from the current page to the error page when there is an exception . Is this possible?

Luigi Viggiano

While you can always add the parameter as a session variable and extract it within the error page, you can also think of adding a property to your custom exception, so the exception will be the vehicle for the param :)

public MyAppException extends Exception {
  Object param;

  MyAppException(String msg, param) {
    this.param = param;

throw new MyAppException("hi there!", "this is the param");