views:

581

answers:

4

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?

+2  A: 

Use Spring Security

Martin K.
+2  A: 

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"
Romeo Foxtrot
A: 

You can also use AbstractWizardFormController if Spring Security is an overkill.

serg
A: 

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"));
    }
Arun P Johny