Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This code honestly <a href="https://stackoverflow.com/questions/3177733/howto-avoid-java-code-in-jsp-files">hurts</a> my eyes. Here is how a generic one should look like. You may find it useful.</p> <pre><code>&lt;%@ page pageEncoding="UTF-8" %&gt; &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt; &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %&gt; &lt;jsp:useBean id="date" class="java.util.Date" /&gt; &lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;title&gt;Error&lt;/title&gt; &lt;link rel="stylesheet" href="style.css"&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Error&lt;/h1&gt; &lt;p&gt;Unfortunately an unexpected error has occurred. Below you can find the error details.&lt;/p&gt; &lt;h2&gt;Details&lt;/h2&gt; &lt;ul&gt; &lt;li&gt;Timestamp: &lt;fmt:formatDate value="${date}" type="both" dateStyle="long" timeStyle="long" /&gt; &lt;li&gt;Action: &lt;c:out value="${requestScope['javax.servlet.forward.request_uri']}" /&gt; &lt;li&gt;Exception: &lt;c:out value="${requestScope['javax.servlet.error.exception']}" /&gt; &lt;li&gt;Message: &lt;c:out value="${requestScope['javax.servlet.error.message']}" /&gt; &lt;li&gt;Status code: &lt;c:out value="${requestScope['javax.servlet.error.status_code']}" /&gt; &lt;li&gt;User agent: &lt;c:out value="${header['user-agent']}" /&gt; &lt;/ul&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The <code>@page isErrorPage</code> is by the way only useful if you want to have the <code>${exception}</code> (i.e. <code>request.getAttribute("exception")</code> available in the JSP. In this particular case you don't need it.</p> <p>And indeed, do not forward in the <code>catch</code> block at all. Just let it go. It will be dealt by the error page then.</p> <pre><code>} catch (MyException ex) { log.error(ex.getMessage(), uivex); throw ex; // Or throw new ServletException(ex.getMessage(), ex); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload