In JSPs, you may use response.sendError(int code, String message)
to return a particular error code (eg 404 for not found) and a message as well.
These messages
Hmm exception.getMessage()
should work
Try adding exception.getClass().getName()
NullPointerException
which has no messageOf course this only works, if I remember correctly, if the error is thrown by a jsp with <%@ page errorPage="/yourerrorpage.jsp" %>
at the top.
If the error comes from a servlet the exception details are passed as request attributes
javax.servlet.error.status_code java.lang.Integer
javax.servlet.error.exception_type java.lang.Class
javax.servlet.error.message java.lang.String
javax.servlet.error.exception java.lang.Throwable
javax.servlet.error.request_uri java.lang.String
javax.servlet.error.servlet_name java.lang.String
Check the Servlet Specification (link is broken since ~2011) section 9.9