Accessing 'model' within test.get.head.ftl
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2011 04:56 AM
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?
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?
Labels:
- Labels:
-
Archive
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2011 08:24 AM
which is the error you're getting?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2011 08:30 AM
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
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
