【发布时间】:2013-12-04 05:43:25
【问题描述】:
我写了下面的faceletindex.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:myCC="http://xmlns.jcp.org/jsf/composite/hui"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<head>
<h:outputStylesheet name="css/centering.css"/>
</head>
<body>
<div style="centerClass">
<mycc:logpass/>
</div>
</body>
</html>
当我从浏览器获取这个 facelet 的内容时,我有
One or more resources have the target of 'head', but no 'head' component has been defined within the view.
因此来自控制台的 html 如下:
<head>
<style type="text/css"></style>
<script type="text/javascript" async="" src="http://www.google-analytics.com/ga.js"></script>
<script type="text/javascript" async="" src="http://cdn.mxpnl.com/libs/mixpanel-2.1.min.js"></script>
<style type="text/css"></style>
</head>
但如果我写
<?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:mycc="http://xmlns.jcp.org/jsf/composite/hui"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<head>
<link href="css/centering" rel="stylesheet" type="text/css"/>
</head>
<body>
<div style="centerClass">
<mycc:logpass/>
</div>
</body>
</html>
没有这个错误信息。为什么?
【问题讨论】: