htmljspjakarta-eemeta

meta tag should be an empty element tag


I am trying to enter the following meta tag in my jsp page using strut taglib

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" name="Webmaster" content="Telephone: <s:text name="webmaster.phone" /> , email:<s:text name="webmaster.email" />, address:<s:text name="webmaster.mail" />">     

But a warning is showing that meta tag should be empty element tag. What should I do to solve this problem? Is there any other way to enter the webmaster information in the meta tag?


Solution

  • If your JSP declare a kind of XHTML DOCTYPE, then the <meta> tag must be properly closed, as discussed in W3School's HTML Versus XHTML tutorial:

    XHTML Empty Elements Must Always be Closed

    In XHTML, empty elements must always be closed, like this:

    Correct:

    A break: <br />
    A horizontal rule: <hr />
    An image: <img src="happy.gif" alt="Happy face" />
    

    Wrong:

    A break: <br>
    A horizontal rule: <hr>
    An image: <img src="happy.gif" alt="Happy face">
    

    So your tag should be:

    <meta 
      http-equiv="Content-Type" 
      content="text/html; 
      ...
      address:<s:text name="webmaster.mail" />"
    />