The Springframework is able to integrate with the freemarker template engine. Spring provides a spring.ftl with core macros and functions to ease form support. To call a macro that builds a form field for you as well as resolves value selection (even for singleSelects or multiSelects).
The essential component that does the myth is their bind macro, which calls some mysterious springMacroRequestContext to get bind status information.
Where the hell does this variable come from and what is hidden behind it?
Responsible for this is the class
org.springframework.web.servlet.view.AbstractTemplateView
, provided byspring-mvc.*.jar
- line 154 / methodrenderMergedOutputModel(.*)
.The template variable is injected by hard coding. Next to some other environmental stuff, I recognized.
When using the springMacroRequestContext we are talking to an instance of
org.springframework.web.servlet.support.RequestContext
.The bind call creates an instance of
org.springframework.web.servlet.support.BindStatus
.I do not write a blog. But there might be folks like me who were searching for this to understand what is going on :)