Reputation:
My application has 3 JSP pages: one is login.jsp
, and the others are loginSuccess.jsp
and loginFail.jsp
. If the username and the password in the login form are correct then it goes to the loginSuccess page but when the username and password are not correct, it doesn't go to the loginFail page.
What do I need to do to get it to work?
Upvotes: 1
Views: 3212
Reputation: 388316
If you don't want to use Spring Security, I think you can use spring mvc RedirectView to redirect the request to differenct pages.
if (success) {
return new ModelAndView(new RedirectView("loginSuccess.jsp"));
} else {
return new ModelAndView(new RedirectView("loginFail.jsp"));
}
Upvotes: 1
Reputation: 111265
You can also use AbstractWizardFormController if Spring Security is an overkill.
Upvotes: 0
Reputation: 71
Spring Security has properties in the config xml. Something like this should do the trick!
default-target-url="loginSuccess.jsp"
authentication-failure-url="/loginFail.jsp"
Upvotes: 2