JSP / Servlet HTTP 404 Error Handling
I'd like to handle HTML 404 errors in my web app. I can write this: 404 /view/error404.jsp
Solution 1:
It's stored as request attribute with the key javax.servlet.forward.request_uri
:
<p>URL: ${requestScope['javax.servlet.forward.request_uri']}</p>
Or if you're still on the legacy JSP 1.x which was already been upgraded over a decade ago, then do so:
<p>URL: <%= request.getAttribute("javax.servlet.forward.request_uri"); %></p>
Post a Comment for "JSP / Servlet HTTP 404 Error Handling"