Thursday, January 19, 2012

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

This error comes due to wrong namespace reference to your header tag. In JSF all html tags are used with prefix <h:YOU_HTML_TEG>

Your template before error

BasicTemplate.xhtml



<?xml version='1.0' encoding='UTF-8' ?>
<!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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">


<f:view>

<head>

<link href="css/default.css" rel="stylesheet" type="text/css" />
<title><ui:insert name="title">FREE ENGLISH WORDS</ui:insert></title>

</head>


<body>

<div id="header">
<ui:insert name="header">
<!-- include your header file or uncomment the include below and create header.xhtml in this directory -->
<ui:include src="./SALHeader.xhtml"/>
</ui:insert>
</div>


<div id="content">
<ui:insert name="content">
Content area. See comments below this line in the source.
<!-- include your content file or uncomment the include below and create content.xhtml in this directory -->
<!-- <div> -->
<!-- <ui:include src="content.xhtml"/> -->
<!-- </div> -->
</ui:insert>
</div>

<div id="footer">
<ui:insert name="footer">
<!-- include your header file or uncomment the include below and create footer.xhtml in this directory -->
<ui:include src="./SALFooter.xhtml"/>
</ui:insert>
</div>

</body>
</f:view>
</html>




After Error Removed

BasicTemplate.xhtml



<?xml version='1.0' encoding='UTF-8' ?>
<!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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">


<f:view>

<h:head>

<link href="css/default.css" rel="stylesheet" type="text/css" />
<title><ui:insert name="title">FREE ENGLISH WORDS</ui:insert></title>

</h:head>


<body>

<div id="header">
<ui:insert name="header">
<!-- include your header file or uncomment the include below and create header.xhtml in this directory -->
<ui:include src="./SALHeader.xhtml"/>
</ui:insert>
</div>


<div id="content">
<ui:insert name="content">
Content area. See comments below this line in the source.
<!-- include your content file or uncomment the include below and create content.xhtml in this directory -->
<!-- <div> -->
<!-- <ui:include src="content.xhtml"/> -->
<!-- </div> -->
</ui:insert>
</div>

<div id="footer">
<ui:insert name="footer">
<!-- include your header file or uncomment the include below and create footer.xhtml in this directory -->
<ui:include src="./SALFooter.xhtml"/>
</ui:insert>
</div>

</body>
</f:view>
</html>

No comments: