@csrfToken

Required Spring Config:

    <mvc:interceptors>
        <bean class="com.ctlok.springframework.web.servlet.view.rythm.interceptor.CsrfTokenInterceptor" />
    </mvc:interceptors>

For HTML Form Post Action:

    <form method="post" action="@url("/register.html")">
        @hiddenCsrfToken()
    </form>
    Result: 
    
    <form method="post" action="/register.html">
        <input type="hidden" value="5d10bffbd21045dfa9ff39c4a023158e" name="_t"/>
    </form>

For Javascript AJAX Post Request:

    var token = "@csrfToken()";
    var data = {
        _t: token,
        username: "username",
        password: "password"
    }
    
    $.post("@url("/register.html")", data, function(result){
        console.log(result);
    });
    Result: 
    
    var token = "5d10bffbd21045dfa9ff39c4a023158e";
    var data = {
        _t: token,
        username: "username",
        password: "password"
    }
    
    $.post("/register.html", data, function(result){
        console.log(result);
    });