So, basically, I am able to create a custom error page using web.xml:
<error-page>
<error-code>404</error-code>
<location>/WEB-INF/pages/error/404.jsp</location>
</error-page>
But so far, in my project, I do not use web.xml and tend to use only java code.
Is there a proper and easy way to do like in web.xml but without using it (create custom error page)? And if there is no such way then would it be a bad move to add web.xml only for handling custom error pages?