title: How to get the message in a custom error page (Tomcat)?
body: <p>In JSPs, you may use <code>response.sendError(int code, String message)</code> to return a particular error code (eg 404 for not found) and a message as well.
  These messages display fine, as long as you use the default ugly Tomcat error pages. However, if you create a custom error page, how do you get that message? 
  I've tried <code>exception.getMessage()</code> or <code>pageContext.getErrorData()</code> but no avail. I've been searching for this for like hours and nobody seems to even wonder about the same thing! :S</p>
  
  <p>I forgot to mention I've only tried it with 404s so far, since that's what I need most... The exception is null for some reason, so trying anything on it throws a NullPointerException.
  The error page is a 404 error page, set via web.xml (since I want it to be displayed for EVERY single 404 error) and for anyone wondering, yes it has the isErrorPage directive set to true...</p>