Reputation: 23
I get the following error on every page of my project when I am removing the MyFaces-2.0
entry from web.xml. My project is created using JSF 2.0.
Error:
One or more resources have the target of 'head', but no 'head' component has been defined within the view.
web.xml:
<context-param>
<param-name>org.jboss.jbossfaces.JSF_CONFIG_NAME</param-name>
<param-value>MyFaces-2.0</param-value>
</context-param>
After removing that entry my custom tag runs. If I put this in web.xml again, then the compiler doesn't go to the component class.
Upvotes: 0
Views: 263
Reputation: 38163
As the message you got says, you have no head component in your view (on your Facelet). Such a component is needed for other components that e.g. want to inject scripts and css resources into the head.
The remedy is to simply add this component on your Facelet, e.g.:
<!DOCTYPE html>
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
>
<!-- The head component that was missing -->
<h:head/>
<h:body>
<!-- Other components here -->
</h:body>
</html>
Upvotes: 2