cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing 'model' within test.get.head.ftl

stephama
Champ in-the-making
Champ in-the-making
Hello,

I am building a webscript with:
- a controler
- a freemarker template for the html response
- a second freemarker template for the html head response

I am feeding the "model" object within the controler and I would like to know if it is possible to have access to this object in the freemarker head?
It works perfectly within the freemarker template of the html response but without success in the freemarker template for the html head response.
Any idea?
2 REPLIES 2

fstnboy
Champ on-the-rise
Champ on-the-rise
which is the error you're getting?

mikeh
Star Contributor
Star Contributor
The model is not available in the head template.

One reason for this design decision is that the head template only gets included *once* for *multiple* instances of the same component within a page. therefore the dynamic code will only be run once, which might not be what you intended.

There's no problem adding dynamic <script> and <link> tags to the <body>, many modern web apps and sites use this technique today.

Thanks,
Mike