HTMLMeta class

The HTMLMeta class represents meta-information used within an HTMLHead tag. Attributes in META tags are used when identifying, indexing, and defining information within the HTML document.

Attributes of the META tag include:

For example, to help search engines determine the contents of a page, you might use the following META tag:

     <META name="keywords" lang="en-us" content="games, cards, bridge">

You can also use HTMLMeta to redirect a user from one page to another.

Methods for the HTMLMeta class include:

Example: Creating META tags

The following example creates two META tags:

     // Create a META tag to help search engines determine page content.
     HTMLMeta meta1 = new HTMLMeta();
     meta1.setName("keywords");
     meta1.setLang("en-us");
     meta1.setContent("games, cards, bridge");
     // Create a META tag used by caches to determine when to refresh the page.
     HTMLMeta meta2 = new HTMLMeta("Expires", "Mon, 01 Jun 2000 12:00:00 GMT");
     System.out.print(meta1 + "\r\n" + meta2);

The previous example produces the following tags:

     <meta name="keywords" content="games, cards, bridge">
     <meta http-equiv="Expires" content="Mon, 01 Jun 2000 12:00:00 GMT">