为什么我会收到"Prefix h for element h:head is not bound"错误?



这是我的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>

每次我尝试运行它时,都会得到错误" element h:element h:head没有绑定。"

这让我发疯。为什么我会遇到此错误?

您需要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>

相关内容

最新更新