title: What is the good approach to forward the exception from servlets to a jsp page?
body: <p>I know I can put something in the web.xml like this </p>
  
  <pre><code>&lt;error-page&gt;  
     &lt;exception-type&gt;java.lang.Throwable&lt;/exception-type&gt;  
     &lt;location&gt;/error.jsp&lt;/location&gt;  
  &lt;/error-page&gt;
  </code></pre>
  
  <p>However the jsp page won't show any contructive information since it won't get what exactly the exception is. I know we can have different exceptions forwarded to different pages by various <code>exception-type</code> but that's too much to write in web.xml. I hope one page is enough and another for handling errors like 404.</p>
  
  <p>So how should I pass the exception information to the jsp page? Use session?</p>
  
  <p>The ideal situation might be the page gets the exception info and show some relevant messages about it without revealing the exception to the users. Instead it could log it into a file for future reference. What is the best approach to achieve this? Thanks.</p>