Java 我的Richfaces 4.0项目赢得';不能使用ui:composition标记
我的Richfaces 4.0项目无法使用ui:composition标记 下面是一个xhtml文件代码:Java 我的Richfaces 4.0项目赢得';不能使用ui:composition标记,java,jsf,richfaces,Java,Jsf,Richfaces,我的Richfaces 4.0项目无法使用ui:composition标记 下面是一个xhtml文件代码: <!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
<!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"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j">
<h:head>
<title>RichFaces</title>
</h:head>
<h:body>
<ui:composition>
<h:form>
<h:selectOneMenu value="#{selectsBean.currentType}"
valueChangeListener="#{selectsBean.valueChanged}">
<f:selectItems value="#{selectsBean.firstList}" />
<a4j:ajax event="valueChange" render="second" execute="@this" />
</h:selectOneMenu>
<a4j:outputPanel id="second" layout="block">
<h:selectOneMenu value="#{selectsBean.currentType}"
rendered="#{not empty selectsBean.currentType}">
<f:selectItems value="#{selectsBean.secondList}" />
</h:selectOneMenu>
</a4j:outputPanel>
</h:form>
</ui:composition>
</h:body>
</html>
富人
若我删除ui:composition标记,页面可以正常工作,但使用此标记,皮肤无法加载,valueChangeListener无法工作。问题出在哪里
UPD:
托马斯指出了一个错误,但佩奇仍然不起作用。现在,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"
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">
<h:form>
<h:selectOneMenu value="#{selectsBean.currentType}"
valueChangeListener="#{selectsBean.valueChanged}">
<f:selectItems value="#{selectsBean.firstList}" />
<a4j:ajax event="valueChange" render="second" execute="@this" />
</h:selectOneMenu>
<a4j:outputPanel id="second" layout="block">
<h:selectOneMenu value="#{selectsBean.currentType}"
rendered="#{not empty selectsBean.currentType}">
<f:selectItems value="#{selectsBean.secondList}" />
</h:selectOneMenu>
</a4j:outputPanel>
</h:form>
</ui:composition>
来自facelets文档:
facelets视图处理程序将忽略UI组合标记之外的任何内容。
从官方的JSF2文档来看:JSF忽略了组合之外的一切…
a确认
标记必须是文件中的顶级元素。来自facelets文档:facelets视图处理程序将忽略UI组合标记之外的任何内容。
从官方的JSF2文档来看:JSF忽略了组合之外的一切…
A好的,
标记必须是文件中的顶级元素。谢谢您提供的信息,但是在我更改它之后,问题仍然存在。您是如何更改的?请注意,您可能会将xml名称空间添加到标记中,即
。您是否也有一个使用
包含文件的页面?请注意,
通常用于包含在某处的模板,而不是用于独立页面。因此,您也必须使用包装页。感谢您提供的信息,但在我更改后,问题仍然存在。您是如何更改的?请注意,您可能会将xml名称空间添加到标记中,即
。您是否也有一个使用
包含文件的页面?请注意,
通常用于包含在某处的模板,而不是用于独立页面。因此,您还必须使用包装页。