Thursday, 21 July 2011

Handling Forbidden Pages in SpringMVC3.0 using annotations

 
@Controller
@RequestMapping(value = "/Login/**")
public class LoginController extends CommonController {
public static final String loginError = "/Login/LoginError";

@RequestMapping(value="/Login.html")
public String login() {
return Globals.login;
}

@RequestMapping(value="/LoginError.html")
public String loginError() {
return loginError;
}

}

Tiles Definition For "/accessDenied"

<definition name="/accessDenied" extends="base">
<put-attribute name="subtitle" value="Login Error" />
<put-attribute name="menu" value="/WEB-INF/tiles/templates/loginMenu.jsp" />
<put-attribute name="body" value="/WEB-INF/jsp/accessDenied/showAccessDenied.jsp" />
</definition>


showAccessDenied.jsp

<p>
Access to the specified resource has been denied.

<br />
Click <a href="<c:url value=''/>"><b><u>here</u></b></a> to try again.

</p>

<!--
For reasons why we set response status=200 refer below link
http://www.coderanch.com/t/365499/Servlets/java/web-xml-error-page-not
-->


Hope this explanation helps.

5 comments:

Anonymous said...

I always emailed this web site post page to
all my contacts, since if like to read it next my contacts will too.


Here is my web site プラダ

Anonymous said...

I am really loving the theme/design of your website.
Do you ever run into any web browser compatibility issues?
A small number of my blog readers have complained about my blog not working correctly in Explorer but looks great in
Opera. Do you have any advice to help fix this problem?


My website - ホリスター激安

Anonymous said...

I don't even know how I finished up here, however I assumed this put up used to be great. I don't know who you're however certainly you're going to a famous blogger in case you aren't already. Cheers!

Here is my weblog: モンスターケーブル

Anonymous said...

Heya superb website! Does running a blog similar to this require a massive
amount work? I have absolutely no understanding of programming however I had been hoping to start
my own blog soon. Anyways, if you have any suggestions or tips for new blog owners please share.

I know this is off subject nevertheless I just had to
ask. Appreciate it!

my homepage - okamiworld.com

Anonymous said...

I am in fact happy to read this blog posts which contains
lots of useful data, thanks for providing these information.


Feel free to surf to my homepage ... クロエ