【发布时间】:2015-03-17 21:18:49
【问题描述】:
我正在使用向文本文档添加标记的 servlet。 例如,它可能会产生以下句子
根据<span class="legalTerm">the plaintiff</span>,合同从未签署
在我的 jsp 中,我有以下 css、html 和 jstl:
<style>
.legalTerm {
background: lightgrey;
color: blue;
font-size: 16px;
font-weight: bold;
text-align:center;
}
</style>
</head>
<body>
<c:out value="${document}"></c:out>
</body>
</html>
当我运行应用程序时,浏览器中显示的文档如下所示:
according to <span class="legalTerm">the plaintiff</span> the contract was never signed
当我查看页面源时,我看到:
according to <span class="legalTerm">the plaintiff</span> the contract was never signed
我能够通过抑制 XML 转义来获得正确的行为
<c:out value="${document}" escapeXml="false"></c:out>
我的问题是:应该这样做吗?
还是我遗漏了一些可以消除抑制 XML 转义的东西?
【问题讨论】: