gpt4 book ai didi

jsf - javax.faces.view.facelets.FaceletException : Error Parsing/my. xhtml:错误跟踪 [行:42] 元素 "f"的前缀 "f:facet"未绑定(bind)

转载 作者:行者123 更新时间:2023-12-03 18:20:12 26 4
gpt4 key购买 nike

我想创建可以将数据库中的数据显示到 JSF 页面的表。我找到了这段代码:

<h:dataTable value="#{bookStore.items}" var="store">
<h:column>
<f:facet name="header">
<h:outputText value="#{msg.storeNameLabel}"/>
</f:facet>
<h:outputText value="#{store.name}"/>
</h:column>
<h:column>
<f:facet name="header">
Subject
</f:facet>
<h:outputText value="#{store.subject}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{msg.storePriceLabel}"/>
</f:facet>
<h:outputText value="#{store.price}"/>
</h:column>
</h:dataTable>

当我使用此代码时,我在 Netbeans 中收到此错误消息:

javax.faces.view.facelets.FaceletException: Error Parsing /my.xhtml: Error Traced[line: 42] The prefix "f" for element "f:facet" is not bound



如果我更换 f带有 h 的标签标签,它会工作吗?或者我必须包括 f标签库?

最佳答案

您必须为 f 前缀包含正确的标记库。

以下是 JSF 2.2 Facelet 页面的示例:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core">

...
</html>

如果您仍在使用 JSF 2.0/2.1,请使用 java.sun.com域而不是 xmlns.jcp.org XML 命名空间中的域。

我建议阅读 JSF 教程,您可以在 our JSF wiki page 中找到链接.

关于jsf - javax.faces.view.facelets.FaceletException : Error Parsing/my. xhtml:错误跟踪 [行:42] 元素 "f"的前缀 "f:facet"未绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9616148/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com