Spring Security Custom freemarker form


I'm currently working on a project were we use freemarker as a template language.
Instead of using the defualt login form I have created a custom controller and a custom freemarker view which goes along with that controller


public class LoginController {
private static finaal String LOGIN = "components/security/login";

public String login(){

    return LOGIN;

my freemarker template:

HTML Code:

<form action="${rc.contextPath}/j_spring_security_check" method="post">
    <label for="username">Username</label><input type="text" id="username" name="j_username"><br/>
    <label for="password">Password</label><input type="text" id="password" name="j_password"><br/>
   <input type="submit" value="Login!">

my applicationContext-security.xml

        <intercept-url pattern="/*" access="ROLE_ADMIN, ROLE_GUEST"/>
        <intercept-url pattern="/security/login" filters="none"/>
        <form-login login-page="/security/login" />

the login works like a charm BUT, when a user enters a wrong username or password no error messages are shown and I can't figure out how to do it. Could you please help me with that.

Best Solution

The code for those who wonder how i did it:

    <@spring.message "login.bad.credentials"/>
Related Question