Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

One or more resources has the target of 'head' but not 'head' component has been defined within the view

I'm using NetBeans 7.3.1 and PrimeFaces 3.5 on GlassFish 3.2.

I created a JSF page with PrimeFaces components. The project runs fine, but the PrimeFaces UI look'n'feel is completely missing. I'm only noticing below message in server log:

One or more resources has the target of 'head' but not 'head' component has been defined within the view

What does this mean and how can I fix the PrimeFaces UI look'n'feel?

like image 625
James Forland Avatar asked Sep 22 '13 05:09

James Forland


1 Answers

This means that you're using plain HTML <head> instead of JSF <h:head> in your XHTML template. The JSF <h:head> allows automatic inclusion of CSS/JS resources in the generated HTML <head> via @ResourceDependency annotations. PrimeFaces as being a jQuery based JSF component library needs to auto-include some jQuery/UI JS/CSS files and this really requires a <h:head>.

So, search for a

<head>
    <title>Some title</title>
    ...
</head>

in your templates and replace it by

<h:head>
    <title>Some title</title>
    ...
</h:head>

See also:

  • What's the difference between <h:head> and <head> in Java Facelets?
  • Unable to understand <h:head> behaviour
  • How to programmatically add JS and CSS resources to <h:head>?
  • How to include another XHTML in XHTML using JSF 2.0 Facelets?
like image 189
BalusC Avatar answered Nov 20 '22 17:11

BalusC