Custom 401 unauthorized error page
JDev: 12.2.1.3.0 Sources: 1) ErrorCodeDemo1-GitHub , 2) ErrorCodeDemo2-GitHub Quite often I see developers ignoring proper error redirection for 401 unauthorized access scenarios. The usual behaviour is to put an enterprise/application role constraint for the homepage and relying on the J2EE container to deliver the default error page. Not only does it look ugly, but it also breaks the application flow, as the end user has no other option provided to rectify the error. This article talks about two simple approaches to display our own error page when an unauthorized user accesses your application. The end-result would be displaying something like this: Approach 1: Declarative This is a simple, one-step approach. You just define a reference to your own error page inside web.xml file, which gets called for a 401 error code. Approach 2: Programmatic The second approach is slightly elaborate. But effectively, there is no difference in the end-result...