【问题标题】:JSP error escape quotes in expression表达式中的 JSP 错误转义引号
【发布时间】:2011-07-10 14:28:26
【问题描述】:

我需要检查类型以显示正确的消息,例如:

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

但是转义产生奇怪错误的问题: 由于词法分析错误,无法分析 EL 表达式

如何解决? 谢谢。

【问题讨论】:

    标签: jsp if-statement escaping expression quotes


    【解决方案1】:

    在 EL 中不能转义双引号。如果标签属性在双引号中,则使用单引号,反之亦然:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-20
      • 1970-01-01
      • 1970-01-01
      • 2021-06-04
      • 1970-01-01
      • 1970-01-01
      • 2011-08-07
      • 1970-01-01
      相关资源
      最近更新 更多