Java web playframework: how to ignore expression evaluation in a template?

In the view (maybe Application / index.html) I had content like:

...
<div>${don't need evaluate this content} </div>
...

I do not want to play! evaluate it, display only this content on the screen, so how can I do it?

Update:

Thanks to Loic and Niels, I just tested them, both solutions:

#{verbatim}${don't need evaluate this content}#{/verbatim}

and

<div>'${don't need evaluate this content}' </div>

does not work!

Note that I use XML in the response type.

+3
source share
4 answers

I managed to get this working using the following

<div>&#36;{don't need evaluate this content}</div>
+3
source

Best practice is to use the verbatim tag:

#{verbatim}${don't need evaluate this content}#{/verbatim}
+1
source

groovy ,

<div>'${don't need evaluate this content}' </div>

. , \$ . &#36; $ .

0
source

All of the above did not work in multi-line systems.
Decision:

${"""  ANY
THING 
IN HERE"""}

"""- here-doc expression in Groovy and PHP.
'''also here is a doc without rating.

so that we can also do %{print(''' ${test} ''')}%

0
source

Source: https://habr.com/ru/post/1777935/


All Articles