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
I'm sorry for answering so late, but I faced with this problem just a week ago, I've browsed a lot of different sites but nobody really aswered this problem the way I wanted to hear. In this post I found out a few interesting solutions and then came up to my own. Just include this source in your page:
<%
out.println(pageContext.getErrorData().getRequestURI());
out.println("
");
out.println(pageContext.getErrorData().getStatusCode());
out.println("
");
out.println(pageContext.getException());
out.println("
");
%>
It worked perfectly fine with me.