Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the springMacroRequestContext called in bind macro of spring.ftl?

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?

like image 200
s10z Avatar asked Jun 16 '15 13:06

s10z


1 Answers

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 :)

like image 196
s10z Avatar answered Nov 15 '22 03:11

s10z