【发布时间】:2011-11-22 05:50:25
【问题描述】:
TL;DR:我无法让 DOCTYPE 标题出现在我的 JSF 页面上。
我刚刚继承了一个 JSF 1.2 项目,该项目在 IE 下存在一些显示问题。我是 JSF 的新手,但我认为问题源于呈现的页面(来自“查看源代码”)不包含正确的 DOCTYPE。
页面由多个部分组成,使用多层<ui:composition> 组合在一起。典型的页面如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
template="../layout/template.xhtml">
<ui:define name="body">
<!-- html content goes here... -->
</ui:define>
</ui:composition>
那么../layout/template.xhtml 有:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
template="./headertemplate.xhtml">
<ui:define name="menuSelection">
<ui:insert name="menuSelection"/>
</ui:define>
<ui:define name="body">
<ui:insert name="body"/>
</ui:define>
<ui:define name="footer">
<div class="footer">
<ui:include src="footer.xhtml"/>
</div>
</ui:define>
</ui:composition>
最后,headertemplate.xhtml:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
contentType="text/html">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<body>
<ui:insert name="body" />
</body>
</html>
</ui:composition>
为简洁起见,我省略了许多 xmlns 行;我希望你能明白。
如何让 DOCTYPE 显示在呈现的页面中?
【问题讨论】: