【问题标题】:Why do I get "Prefix h for element h:head is not bound" error? [duplicate]为什么我会收到“元素 h 的前缀 h:head 未绑定”错误? [复制]
【发布时间】:2017-02-24 07:29:00
【问题描述】:

这是我的 xhtml 文件:

<html>
<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=Cp1252"/>
</h:head>

<h:body>
    <view>
        <h:form>
            <br/>
            <br/>

            <center>
                <h:panelGrid columns="2">
                    <f:facet name="header">
                        <h:outputText value="Login"/>
                    </f:facet>

                    <h:outputText value="Benutzername:"/>
                    <h:inputText value="#{benutzer.benutzerName}" size="18"/>
                    <h:outputText value="Passwort: "/>
                    <h:inputSecret value="#{benutzer.passwort}" size="18"/>

                    <f:facet name="footer">
                        <h:commandButton value="Login" action ="#{benutzer.doLogin}"/>
                    </f:facet>
                </h:panelGrid >
            </center>
        </h:form>
    </view>
</h:body>

每次我尝试运行它时都会收到错误消息“元素 h 的前缀 h:head 未绑定。”

这让我发疯。为什么会出现此错误?

【问题讨论】:

    标签: html jsf xhtml


    【解决方案1】:

    你需要 h 命名空间

    <!DOCTYPE HTML>
    <html lang="en" xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
    ...
    </h:head>
    <h:body>
    ...
    </h:body>
    </html>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-05-15
      • 2013-05-31
      • 1970-01-01
      • 1970-01-01
      • 2012-01-30
      • 2021-07-12
      • 1970-01-01
      相关资源
      最近更新 更多