[英]Disable HTML Warnings in Eclipse for Java EE developers edition
I am working on a Web App with Eclipse for Java EE. 我正在使用Eclipse for Java EE开发Web应用程序。 I have JSP files that are built with HTML files as includes.
我有使用HTML文件构建的JSP文件作为包含。 My index.jsp looks like this:
我的index.jsp看起来像这样:
<jsp:include page="include/top.html" />
<title>Title!</title>
<jsp:include page="include/header.html" />
<jsp:include page="include/menu.html" />
<div class="span-15 prepend-1 last">
<h6>What is an <a href="http://en.wikipedia.org/wiki/Application_programming_interface">API</a>?</h6>
<p>An application programming interface (API) is an interface that software programs implement in order to allow other software to interact with it; much in the same way that software might implement a User interface in order to allow humans to interact with it.</p>
</div>
<jsp:include page="include/footer.html" />
The problem is with the includes. 问题在于包含。 footer.html Looks like this:
footer.html看起来像这样:
<hr />
<h3 class="alt"><b><a href="/copyright.html">Copyright</a> © 2009</b> My Company. All rights reserved.</h3>
<hr />
<p>
Visit <a href="/">Home</a>
</p>
</div>
</body>
</html>
Which gets put at the bottom of most pages. 它放在大多数页面的底部。 And I'm really annoyed with these warning messages like
Invalid location of tag (body).
我真的很烦恼这些警告信息,如
Invalid location of tag (body).
I know its invalid within this file but the other side belongs with header.html. 我知道它在此文件中无效,但另一方属于header.html。
In Java classes you can suppress warnings with things like @SuppressWarnings("serial")
... Any way to do something like this with these HTML or JSP files? 在Java类中,您可以使用
@SuppressWarnings("serial")
类的内容来抑制警告...使用这些HTML或JSP文件可以做任何类似的事情吗?
Properties
-> Validation
(or you can go to Window
-> Preferences
-> Validation
to do this globally). Properties
- > Validation
(或者您可以转到Window
- > Preferences
- > Validation
以全局执行此操作)。 The only way that I'm aware of to solve this is to disable HTML validation for the project. 我知道解决这个问题的唯一方法是禁用项目的HTML验证。 Right click the project in question and go to properties, then go to the validation menu.
右键单击有问题的项目并转到属性,然后转到验证菜单。 You can either disable all HTML validation or go into the "HTML Syntax" validation sub-menu and disable individual problems.
您可以禁用所有HTML验证,也可以进入“HTML语法”验证子菜单并禁用个别问题。
即时通讯使用myeclipse并在window-> preferences-> validation-> jsp中有很多选择
@ ChssPly76是正确的,但是我想添加它(使用Mars),在执行这些步骤之后,我还需要重新验证项目以删除Problems部分中的警告(右键单击项目, 验证 )。
2018-01-07: Eclipse Oxygen. 2018-01-07:Eclipse Oxygen。
Things may have changed in this regard since 2009, because what I find at the moment is that you can tweak HTML errors and warnings globally (Window --> Prefs --> Web --> HTML Files --> Validation), or you can tweak on a per-project basis: Project --> Properties --> Validation --> HTML Syntax. 自2009年以来,这方面的情况可能已经发生了变化,因为我现在发现的是你可以全局调整HTML错误和警告(Window - > Prefs - > Web - > HTML Files - > Validation),或者你可以基于每个项目进行调整:项目 - >属性 - >验证 - > HTML语法。
For example I just set Text Regions --> Invalid text string to "Ignore" because I was getting spurious warnings for some Django HTML files with placeholders (or whatever they're called). 例如,我只是将文本区域 - >无效的文本字符串设置为“忽略”,因为我收到了一些带有占位符的Django HTML文件的虚假警告(或者他们被称为的任何内容)。
I also found that I was getting a warning for the hidden
attribute in DIVs: "your attribute should be followed by an = character". 我还发现我在DIV中收到
hidden
属性的警告:“你的属性应该跟一个=字符”。 Oh dear: in HTML5 hidden
is a boolean
, Eclipse is therefore getting this wrong. 哦亲爱的:在HTML5中
hidden
是一个boolean
,因此Eclipse会出错。 I therefore set Attributes --> "Missing attribute equals sign character" to "Ignore" as well. 因此,我将属性 - >“缺少属性等于符号字符”设置为“忽略”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.