JSF template: rendered page missing DOCTYPE

血红的双手。 提交于 2019-11-30 23:17:07
BalusC

Remove <ui:composition> from your master template, which is the headertemplate.xhtml. It doesn't belong there. The <ui:composition> will strip all other content outside the tag.

<!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">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </head>
    <body>
        <ui:insert name="body" />
    </body>
</html>

Note that the doctype (and xml) declaration is unnecessary in template definition files (the ones using <ui:composition>). Just remove them.

See also:

You must remember one thing, that everything outside ui:compostion tags is simply cut out, so the DOCTYPE declaration in your case is simply ignored.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!