java web playframework: how to ignore Evaluating Expression in a Template?
In view (may be Application/index.html), I had the content like:
...
<div>${don't need evaluate this content} </div>
...
I don't want Play! evaluate it, only display absolutely this content on screen, so how can I do it ?
Update:
Thank Loic and Niels, I have just checked them, both solutions:
#{verbatim}${don't need evaluate this content}#{/verbatim}
and
<div>'开发者_StackOverflow${don't need evaluate this content}' </div>
didn't work!
Note that, I use XML in response type.
I managed to get this working using the following
<div>${don't need evaluate this content}</div>
The best practice is to use the verbatim tag:
#{verbatim}${don't need evaluate this content}#{/verbatim}
From my groovy experience I would guess to use simple quotes so
<div>'${don't need evaluate this content}' </div>
But it's not tested. Perhaps \$ works too. At least $ instead of $ should work.
All above didn't work in multilines.
Solution:
${""" ANY
THING
IN HERE"""}
""" is here-doc expression in Groovy and PHP.
''' is also here-doc without evaluation.
so, we can also do %{print(''' ${test} ''')}%
加载中,请稍侯......
精彩评论