In some JSP pages, I want to the page display
<h4>${id}</h4>
However, EL will try to evaluate "id" variable and leave it to blank(not find the variable) or the actual value.
<h4>123</h4>
I know there is a
<%@ page isELIgnored="false" %>
but this will disable EL for the whole JSP page.
Is there any way to disable EL just for a few lines?
Thanks guys, I also write a post about this. http://www.ke-cai.net/2010/12/jquery-template-markup-and-jsp.html
Backslash is the easiest.
<h4>\${id}</h4>
Edit: I have used this method in conjunction with the offical jQuery Template plugin which has variables of the same syntax.
From the JSP 2.0 spec :
Quoting in EL Expressions
'${'
if the literal ${
is desired and expressions are enabled for the page. For example, the evaluation of ${'${'}
is '${'
. Note that ${'}'}
is legal, and simply evaluates to '}'
. So in your case, instead of:
<h4>${id}</h4>
do this:
<h4>${'${'}id}</h4>
It certainly doesn't look pretty but it's what the Java Community Process settled on.
将$
表示为HTML / XML实体。
<h1>${id}</h1>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.