Is this the only way to forward error from servlet to JSP?
Are there any other simple and efficient ways?
Yes. You can put things in your web.xml file that will redirect all exceptions to the same error page, or you can pick out specific exceptions to go to different error pages, or you can go to error pages in response to HTTP status codes, e.g. 404(file not found). The error page is essentially handling the exception, so the container provides the error page with the exception object--if the error page contains the following page directive:
<%@ page isErrorPage="true" %>
Here is an example of what goes in the web.xml file:
for all exceptions
-----------------
The path to the error page is relative to the webapp root and starts with a slash.
[ October 06, 2006: Message edited by: sven studde ]