PrimeFaces CSS look’n’feel missing and JS “Uncaught Reference Error: PrimeFaces is not defined”

PrimeFaces will auto-include the necessary JS/CSS resources in <h:head>.

However, you don’t have that tag. You’ve there a “plain HTML” <head>. Fix it accordingly:

<html>
    <h:head>
        ...
    </h:head>
    <h:body>
        ...
    </h:body>
</html>

This mistake should also have been logged in the server log as below:

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

See also How to include another XHTML in XHTML using JSF 2.0 Facelets? and When to use <ui:include>, tag files, composite components and/or custom components? for various correct examples of authoring JSF/Facelets pages.


Unrelated to the concrete problem: PrimeFaces as being a jQuery based JSF component library already ships with jQuery and jQuery UI bundled. You should remove the manually included scripts from your page to avoid conflicts. See also Adding jQuery to PrimeFaces results in Uncaught TypeError over all place.

Take immediately the opportunity to replace that verbose <link> by a <h:outputStylesheet>. See also How to reference CSS / JS / image resource in Facelets template?

Leave a Comment