简体   繁体   English

在Eclipse中为Java EE开发人员版本禁用HTML警告

[英]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> &copy; 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文件可以做任何类似的事情吗?

  1. Right click on your project, Properties -> Validation (or you can go to Window -> Preferences -> Validation to do this globally). 右键单击您的项目, Properties - > Validation (或者您可以转到Window - > Preferences - > Validation以全局执行此操作)。
  2. Uncheck "Build" for HTML syntax validation OR 取消选中“构建”以进行HTML语法验证或
  3. Click ellipsis under "Settings" and add a rule to exclude specific file name / extension / what have you 单击“设置”下的省略号并添加规则以排除特定文件名/扩展名/您有什么

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.

相关问题 不能将Eclipse的Google插件添加到Eclipse的Java EE开发人员(Helios版)中吗? - Can't add Google Plugin for Eclipse to Eclipse for Java EE developers (Helios edition)? 面向Java EE开发人员的Eclipse IDE - Eclipse IDE for Java EE Developers 针对Web开发人员的Eclipse Java EE IDE中的PrimeFaces - PrimeFaces in Eclipse Java EE IDE for Web Developers 如何为Java EE开发人员升级Eclipse? - How to upgrade Eclipse for Java EE Developers? Eclipse IDE for Java EE Developers和Eclipse Juno之间的区别 - Difference between Eclipse IDE for Java EE Developers and Eclipse Juno Eclipse for Java(EE)Developers和Eclipse Classic之间有什么区别? - What is the difference between Eclipse for Java (EE) Developers and Eclipse Classic? 用于Web开发人员的Eclipse Java EE IDE工具提示颜色 - Eclipse Java EE IDE for Web Developers tooltip color 使用“Eclipse IDE for Java EE Developers”软件包修复ClosedFileSystemException错误 - Getting a fix for ClosedFileSystemException bug with “Eclipse IDE for Java EE Developers” package 如何使用JSF 2 + Eclipse Java EE Web Developers + Hibernate创建项目? - How create a project with JSF 2 + Eclipse Java EE Web Developers + Hibernate? 适用于 JavaScript 和 Web 开发人员的 Eclipse IDE 与适用于 Java EE 的 Eclipse IDE 之间的区别 - Difference between Eclipse IDE for JavaScript and Web Developers and for Java EE
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM