14

我试图在我的 JSP 中包含一个 HTML 文件,但我 Eclipse 显示了这个错误

包含的文件

<%@include file="includes/head.html" %>

和错误

Processing instruction not closed

而这只是简单的 JSP

<%@include file = "includes/head.html" %>

    <form action = "#" method = "POST">
        Username: <input type = "text" name = "username"><br/>
        Password: <input type = "password" name = "password"><br/>
    </form>
</body>
</html>
4

7 回答 7

65

选择全部,退格,然后 ctrl+z 恢复。为我工作。但是熟悉日食的人可能会对为什么会发生这种情况有所了解

于 2013-07-10T03:30:07.790 回答
11

这看起来很疯狂,但是按 ctrl + A,ctrl + x,粘贴并保存代码,Bug 已清除

于 2014-07-13T05:34:23.460 回答
3

此外,关闭文档并再次打开它似乎可以正常工作(请记住先保存文档)。

于 2016-09-29T19:34:11.677 回答
1

我尝试了 Anurag Priyadarshi 的回答,但没有奏效。但是我通过重新启动 eclipse 来消除这个错误,你可能想试试它对我有用。:)

于 2014-05-13T06:15:16.143 回答
1

通过删除错误文件将相同的代码保存在新文件中对我有用。

于 2016-08-12T07:10:36.207 回答
0

尝试在@ 后面留一个空格。

<%@ include file="includes/head.html" %>.

此外,如果 head.html 在其他目录中,则绝对路径应以 / 或 .. 开头。尝试 <%@ include file="/includes/head.html" %>

<%@ include file="../includes/head.html" %>.
于 2012-10-16T06:27:22.307 回答
0

重新启动eclipse对我有用。

于 2019-12-09T11:54:20.367 回答