JSP error escape quotes in expression

[亡魂溺海] 提交于 2019-12-13 16:10:07

问题


I need to check type to display correct message like:

${row.type} <c:if test="${row.stype ==\"Note\" }">Important Note</c:if>

But the problem that escaping produce strange error: Unable to analyze EL expression due to lexical analysis error

How it can be fixed? Thanks.


回答1:


Double quotes must not be escaped in EL. Use single quotes if the tag attribute is in double quotes, and vice-versa:

<c:if test="${row.stype == 'Note'}">Important Note</c:if>

or

<c:if test='${row.stype == "Note"}'>Important Note</c:if>


来源:https://stackoverflow.com/questions/6641650/jsp-error-escape-quotes-in-expression

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!