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}
You can use \${expression}. If you are not using EL in that JSP page. then you can use
<%@ page isELIgnored ="true" %>.
I would recommend you to use \${expression} and use the EL in other part of JSP. EL is very powerful and very helpful.
~Rajiv
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With