【发布时间】:2016-03-04 16:26:48
【问题描述】:
我在 JSP 文件中收到了一些奇怪的警告:
标签位置无效(h4)
标签位置无效 (p)
这是我的代码:
<!DOCTYPE html>
<html>
<head>
</head>
<body role="document">
<div class="container container-white">
<div class="list-group col-sm-12">
<c:forEach var="recipe" items="${resultList}">
<a href="<c:url value="/recipe/viewRecipe/${recipe.id}"/>" class="list-group-item">
<h4 class="list-group-item-heading">${recipe.name}</h4>
<p class="list-group-item-text">${recipe.description}</p>
</a>
</c:forEach>
</div>
</div>
</body>
</html>
我使用的是 STS 3.6.4,并且不希望关闭 html 验证,因为它在其他情况下很有帮助,因为我的 html 技能参差不齐。上面的代码实际上与 Bootstrap 示例 Custom Content 相同。我看到了一些关于在 <a> 标签中不允许使用阻塞元素的帖子,但即使是 W3 网站也有类似的例子:
<aside class="advertising">
<h1>Advertising</h1>
<a href="http://ad.example.com/?adid=1929&pubid=1422">
<section>
<h1>Mellblomatic 9000!</h1>
<p>Turn all your widgets into mellbloms!</p>
<p>Only $9.99 plus shipping and handling.</p>
</section>
</a> <a href="http://ad.example.com/?adid=375&pubid=1422">
<section>
<h1>The Mellblom Browser</h1>
<p>Web browsing at the speed of light.</p>
<p>No other browser goes faster!</p>
</section>
</a>
</aside>
我尝试将<section> 标签添加到我的代码中,但随后我在该标签上收到了同样的无效位置警告。
有什么想法吗?
编辑:我忘了提到编写的代码确实可以正常工作,但如果可能的话,我仍然想摆脱警告。我看过提到 Eclipse/STS JSP/HTML 验证的 SO 帖子可能有点不稳定,但在我使用它的 9 个月里我还没有看到过。
【问题讨论】:
标签: eclipse html jsp eclipse-wtp