CsrfToken token = (CsrfToken) ViewUtils.getRequest().getAttribute("_csrf");
String output = String.format("<input type='hidden' id='csrf' name='%s' value='%s' >", token.getParameterName(), token.getToken());
return new SafeString(output);
This outputs a valid CSRF input tag wherever I call csrfInput() in the template.
Is there a better way of doing this, to output a whole HTML element, other than a function?
Cheers
Rob