Your new site finally needs the last thouch. You’re wasting your time walking back and forth in your room trying to think about what to do to improve it: suddenly, you remember that time when you first saw a customized landing page for that (otherwise) annoying 403 error.
Now the question is: how the hell can I do that?
And here’s the answer!
(Yes, that was an absolutely boring post introduction, but I’m not a writer. Not yet, at least.)
The steps!
-
In
security-config.xml
<security:access-denied-handler error-page="/accessdenied">
-
In
webmvc-config.xml
<mvc:view-controller path="/accessdenied" view-name="common.accessdenied"> </mvc:view-controller>
-
In
tiles-defs.xml
(your tiles definitions file) define the tile for your landing page<definition extends="template" name="errors.denied"> <put-attribute name="content" value="/WEB-INF/views/denied.jsp"> </put-attribute></definition>
Obviously, change the paths consequently to your
denied.jsp
location.
You’re done!
Now, you just have to customize the jsp in order to show the contents you want.