开发者

Disable HTML Warnings in Eclipse for Java EE developers edition

开发者 https://www.devze.com 2022-12-14 01:14 出处:网络
I am working on a Web App with Eclipse for Java EE. I have JSP files that are built with HTML files as includes. My index.jsp looks like this:

I am working on a Web App with Eclipse for Java EE. I have JSP files that are built with HTML files as includes. My index.jsp looks like this:

<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 oth开发者_JS百科er 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:

      <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). I know its invalid within this file but the other side belongs with 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?


  1. Right click on your project, Properties -> Validation (or you can go to Window -> Preferences -> Validation to do this globally).
  2. Uncheck "Build" for HTML syntax validation OR
  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. 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.


im using myeclipse and at window->preferences->validation->jsp there is bunch of choices


@ChssPly76 is correct, but I'd like to add that (using Mars), after following those steps, I was also required to re-validate the project to remove the warnings in the Problems section (right click project, validate).


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.

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).

I also found that I was getting a warning for the hidden attribute in DIVs: "your attribute should be followed by an = character". Oh dear: in HTML5 hidden is a boolean, Eclipse is therefore getting this wrong. I therefore set Attributes --> "Missing attribute equals sign character" to "Ignore" as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号