Question

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?

Was it helpful?

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" />"
/>

OTHER TIPS

I had the same Eclipse warning in my html code and discovered it's b/c I didn't properly close the meta tag.

Example incorrect meta tag:

<meta name="description" content="blah blah">

Fixed by properly closing meta tag with "/>" :

<meta name="description" content="blah blah"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top