https://apps.cs50.net/img/error403.gif |
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!
1) In security-config.xml<security:access-denied-handler error-page="/accessdenied">
2) In webmvc-config.xml
<mvc:view-controller path="/accessdenied" view-name="common.accessdenied"> </mvc:view-controller>
3) 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.
I suggest you to take a look at the 404 github pages: they're awesome.
No comments:
Post a Comment