6

I have this annoying behaviour with Eclipse where it warns me about the <main> element in my JSP file.

I've got <!DOCTYPE html> at the top of my page and I'm using several other HTML5 elements, such as <header> and <footer>, but Eclipse doesn't give a warning about these.

I tried switching off HTML and JSP syntax validation but that didn't seem to work.

I just don't understand why it has a problem with the <main> tag but not other HTML5 tags and that little yellow underline is SUPER irritating.

How can I get Eclipse to ignore this tag?

Thank you in advance for your answers.

Redtama
  • 1,603
  • 1
  • 18
  • 35
  • 2
    try this http://stackoverflow.com/questions/4193905/warnings-of-valid-html5-attributes-in-eclipse – safin chacko Feb 16 '16 at 13:27
  • Thank you very much! I discovered that my version of Eclipse does actually allow you to ignore a specific element that you want to ignore. – Redtama Feb 16 '16 at 14:55

3 Answers3

7

So, it seems like people were having a similar problem with HTML5 attributes according to the question linked in the comment @safin chacko.

The answers posted there show how you could get Eclipse to ignore validation of specified attributes. Since then it seems that Eclipse has the added feature of being able to also ignore validation of specified elements

I have posted an answer on that question which also answers my own question.

Community
  • 1
  • 1
Redtama
  • 1,603
  • 1
  • 18
  • 35
1

There appears to be a Bugzilla item for this already. Hopefully, when that is addressed, the problem will go away.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=516758

In the meantime, you can suppress the warning by going to Eclipse > Preferences > Web > HTML Files > Validation and adding main to the comma-separated list element names to be ignored.

Patrick
  • 71
  • 10
0

One of the cause for this warning might be you are using footer tag without a header tag.

1.Create a separate file say "Footer.html" and write your footer content in that.

2.Include that footer.html in your main .jsp file through : <%@ include file="Footer.html"%>

You can try the same for header also.

Pratik Roy
  • 117
  • 1
  • 3