Search code examples
jsf-2facelets

JSF ui:include on mojarra gives "One or more resources have the target of 'head', but no 'head' component has been defined within the view."


I'm loading achild *.xhtml file in my jsf page with ui:include. When I load this

<html>
  <head/>
  <body>
    Testing
  </body>
</html>

I get this error One or more resources have the target of 'head', but no 'head' component has been defined within the view.

However - when I modify it to this:

<html>
  <!-- <head/> -->
  <body>
    Testing
  </body>
</html>

The error goes away. (The child *.xhtml file comes from a static content team so it can't have jsf directives in it).

What is the root cause? How can this be avoided?

Versions:

  • Mojarra 2.0
  • Java 7.0
  • Tomcat 7.0
  • Windows 7.0

Solution

  • It's talking about the <h:head>. Do the same for the body, which should be <h:body>.

    By the way, the generated HTML output must be syntactically valid. You usually don't put <html> in an include file, but only in the parent file or the master template.

    See also: