避免在 JSP 标记中嵌套单引号或双引号

如果单引号嵌套在单引号中,或者双引号嵌套在双引号中,那么此规则会对 JSP 标记进行标记。

示例 1:
<c:if test="<%=(link.indexOf(':') == -1)%>" >

在此示例中, test 属性包含字符序列 ':' 嵌套在外部单引号中 '<%=(link.indexOf(':') == -1)%>' . 此规则将标记此示例。

自动修复将转义嵌套引号。 在示例中,引号 的引号。 ':' 已转义。

示例:
<c:if test="<%=(link.indexOf(\':\') == -1)%>" >

在 JSP 标记中嵌套引号会导致类似以下示例的错误消息:

Error Message:JSPG0048E: Page failed to validate using taglib validator for ... : org.xml.sax.SAXParseException: Attribute name "jsp:id" associated with an element type "c:if" must be followed by the " = " character.
Root Cause:com.ibm.ws.jsp.translator.JspTranslationException: JSPG0048E: Page failed to validate using taglib validator for...

有关更多信息,请参阅: