0

Given this:

render(template: 'someTemplate', model: [codec: 'none'])

It seems that I cannot use the codec variable in the page directive. Tried these:

<%@page defaultCodec="codec" %>
<%@page defaultCodec="${codec}" %>
<%@page defaultCodec=codec %>

Is there a way to pass the coded in the model?

zoran119
  • 10,657
  • 12
  • 46
  • 88

1 Answers1

0

About this..

UPDATE

<g:set var="defaultCodec"   value="${codec}" />

<%@page defaultCodec="${defaultCodec}" %>
Merlin
  • 4,907
  • 2
  • 33
  • 51
  • what happens then ? what is the value of "defaultCodec" – john Smith Jan 04 '14 at 20:20
  • How do you use default defaultCodec ? What make you say it is not working ? – Merlin Jan 04 '14 at 21:15
  • I expect no codec to be used for my page (just like putting `<%@page defaultCodec="none" %>` into the page), but after adding the suggested answer the default `XML` codec is still used. – zoran119 Jan 04 '14 at 21:28
  • Ok I didnt understood your question, I think I get it now did you check this post ? http://stackoverflow.com/questions/1337464/overriding-grails-views-default-codec-html-config-back-to-none – Merlin Jan 04 '14 at 21:38
  • I did see that question but it is not what I'm after either. I want to pass a `String` from the controller (as part of the `model`) and set the `defaultCodec` for that entire page to the codec passed in the `model`. Basically, I want to set the `defaultCodec` based on some logic in the controller. – zoran119 Jan 04 '14 at 21:54