Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Unknown tag (main)" warning in JSP file in Eclipse

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.

like image 261
Redtama Avatar asked Feb 16 '16 12:02

Redtama


2 Answers

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.

like image 84
Redtama Avatar answered Nov 05 '22 03:11

Redtama


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.

like image 1
Patrick Avatar answered Nov 05 '22 02:11

Patrick