表达式中的JSP错误转义引号 [英] JSP error escape quotes in expression

查看:64
本文介绍了表达式中的JSP错误转义引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need to check type to display correct message like:

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

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

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

如何解决? 谢谢.

推荐答案

在EL中不能对双引号进行转义.如果tag属性用双引号引起来,则使用单引号,反之亦然:

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>

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

这篇关于表达式中的JSP错误转义引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆