In JSP, I notice that I can't render ${} into HTML. After the page is rendered, the HTML page will not show ${} anymore. In my understanding, ${} is part of java syntax.
Is there any approach to render this into HTML? Currently, I use print "${}" as a string so I can render this on my HTML. I need this symbol to be rendered as it is so later I can grab this symbol using jquery. (FYI: I'm using jquery template)
Thanks in advance
\${this is not an EL expression}
Escape the expression with \
if it appears in a JSP template.
From the JSP EL 2.2 specification:
To generate literal values that include the character sequence
${
or#{
, the developer can choose to use a composite expression as shown here:${'${'}exprA} #{'#{'}exprB}
The resulting values would then be the strings
${exprA}
and#{exprB}
.Alternatively, the escape characters
\$
and\#
can be used to escape what would otherwise be treated as an eval-expression. Given the literal-expressions:\${exprA} \#{exprB}