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 by
spring-mvc.*.jar
- line 154 / method renderMergedOutputModel(.*)
.
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 :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With