我知道这个问题已被问过几次,但我似乎无法找到我的代码有什么问题,所以我再次要求它 - 抱歉:-).
我目前正在使用部署在Glassfish上的JavaEE6框架上的JSF2.1.对于抛出此错误的页面,我有一个baseTemplate,其中包含页眉和页脚.然后我有一个继承baseTemplate的页面,基本上它们是:BaseTemplate:
<?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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<f:view>
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<link rel="shortcut icon" href="" />
<h:outputStylesheet library="css" name="site.css" target="head"></h:outputStylesheet>
<ui:insert name="head" />
</h:head>
<h:body>
<div id="wrapper" class="rounded-box">content...
Run Code Online (Sandbox Code Playgroud)
头
<?xml version='1.0' encoding='UTF-8' ?>
<f:view xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<div class="header">
Run Code Online (Sandbox Code Playgroud)
页脚只包含普通的html标签.
和实际的页面,这是一个登录.
<?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">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
template="/shared/page/_twoColumn.xhtml">
<ui:define name="head"></ui:define>
<ui:define name="leftContent">
</ui:define>
<ui:define name="content">...........
Run Code Online (Sandbox Code Playgroud)
可能是什么问题呢?请注意,我已经有了xmlns:h ="http://java.sun.com/jsf/html"命名空间.
谢谢,
czetsuya
页脚只包含普通的html标签.
您还需要http://www.w3.org/1999/xhtml在根元素中声明默认的XML命名空间.您最好<ui:composition>在所有包含和模板文件中使用XML根元素(也是标题; <f:view>根本不属于那里).
/WEB-INF/footer.xhtml
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
>
<div>Plain HTML</div>
</ui:composition>
Run Code Online (Sandbox Code Playgroud)
在[html tag]这你在警告消息看到的是它出现在页脚中的第一个纯HTML标签.
| 归档时间: |
|
| 查看次数: |
11163 次 |
| 最近记录: |