0

I want to display an audio file in a JSF file, and this is my code. The problem is that, in my Eclipse editor, it always reminds that "Unknown tag (audio). " with a yellow warning in Eclipse. I test it in the web server, can's see anything related to the audio shown on the page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">

<!-- The template for our app, defines some regions -->


<body>

    <div id="container" align="left">
        <div id="header">
            <img src="resources/images/logo.png" alt="logo photo" />
        </div>
        <br />      

        <div id="content">
            <ui:insert name="content" />
        </div>

        <br style="clear: both" />
    </div>
    <audio src="resources/audio/test.wav" /> 

</body>
</html>
Kukeltje
  • 12,223
  • 4
  • 24
  • 47
user697911
  • 10,043
  • 25
  • 95
  • 169
  • 2
    As to unknown tag, why are you using XHTML doctype instead of HTML5 doctype? You said yourself, it's a HTML5 element. So you should use a HTML5 doctype instead. As to the attribute, XML doesn't support attribute minimization, just specify an arbitrary value, e.g. `controls="controls"` like you'd do for `checked="checked"`, `selected="selected"`, etc. – BalusC Sep 22 '15 at 17:52
  • Yeah, that's the problem. But what I really need is to display audio in a JSF file, not really a HTML5 page. I thought JSF is eventually converted into HTML. Right? – user697911 Sep 22 '15 at 17:55
  • Food for read: http://stackoverflow.com/questions/19189372/javaserver-faces-2-2-and-html5-support-why-is-xhtml-still-being-used – BalusC Sep 22 '15 at 17:55
  • I simplified it to . The red flag error message is gone in the editor, but still a yellow flag in the editor indicating that it's an "unknown tag". – user697911 Sep 22 '15 at 17:57
  • Please see my updated question. – user697911 Sep 22 '15 at 18:04
  • Any clues in browser's web developer toolset? (press F12 in case you didn't know) – BalusC Sep 22 '15 at 18:52
  • It turns out that HTML5 tag although it still warns that the tag is unknown. – user697911 Sep 23 '15 at 20:33

1 Answers1

1

As stated by BalusC, this can be resolved by changing the doctype to

<!DOCTYPE html>

JSF can work with it.

See also:

Kukeltje
  • 12,223
  • 4
  • 24
  • 47