<;f:facet>;标记库支持命名空间:http://java.sun.com/jsf/html,但没有为name:facet定义标记

<;f:facet>;标记库支持命名空间:http://java.sun.com/jsf/html,但没有为name:facet定义标记,jsf,Jsf,我正在测试PrimeFaces示例,该示例可在上获得。我在EclipseDyamicWeb项目中正确地导入了PrimeFaces和JSF2.1,但在启动网页(使用Tomcat)时出现以下错误: login.xhtml包含: package classi; import java.awt.event.ActionEvent; import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext;

我正在测试PrimeFaces示例,该示例可在上获得。我在EclipseDyamicWeb项目中正确地导入了PrimeFaces和JSF2.1,但在启动网页(使用Tomcat)时出现以下错误:

login.xhtml包含:

package classi;
import java.awt.event.ActionEvent;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

import org.primefaces.context.RequestContext;
public class LoginBean
{
    private String username;  

    private String password;  

    public String getUsername() {  
        return username;  
    }  

    public void setUsername(String username) {  
        this.username = username;  
    }  

    public String getPassword() {  
        return password;  
    }  

    public void setPassword(String password) {  
        this.password = password;  
    }  

    public void login(ActionEvent actionEvent) {  
        RequestContext context = RequestContext.getCurrentInstance();  
        FacesMessage msg = null;  
        boolean loggedIn = false;  

        if(username != null  &&/*&&*/ username.equals("admin") && password != null  && password.equals("admin")) {  
            loggedIn = true;  
            msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Welcome", username);  
        } else {  
            loggedIn = false;  
            msg = new FacesMessage(FacesMessage.SEVERITY_WARN, "Login Error", "Invalid credentials");  
        }  

        FacesContext.getCurrentInstance().addMessage(null, msg);  
        context.addCallbackParam("loggedIn", loggedIn);  
    }  
}
<?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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
</head>
<body>
<h:outputLink id="loginLink" value="javascript:void(0)" onclick="dlg.show()" title="login">     
    <p:graphicImage value="/images/login.png" />  
</h:outputLink>  

<p:growl id="growl" showDetail="true" life="3000" />  

<p:dialog id="dialog" header="Login" widgetVar="dlg">  
    <h:form>  

        <h:panelGrid columns="2" cellpadding="5">  
            <h:outputLabel for="username" value="Username:" />  
            <p:inputText value="#{loginBean.username}"   
                    id="username" required="true" label="username" />  

            <h:outputLabel for="password" value="Password:" />  
            <h:inputSecret value="#{loginBean.password}"   
                    id="password" required="true" label="password" />  

            <f:facet name="footer">  
                <p:commandButton id="loginButton" value="Login" update=":growl"   
                    actionListener="#{loginBean.login}"   
                    oncomplete="handleLoginRequest(xhr, status, args)"/>  
            </f:facet>

        </h:panelGrid>  

    </h:form>  
</p:dialog>  

<script type="text/javascript">  
    function handleLoginRequest(xhr, status, args) {  
        if(args.validationFailed || !args.loggedIn) {  
            jQuery('#dialog').effect("shake", { times:3 }, 100);  
        } else {  
            dlg.hide();  
            jQuery('#loginLink').fadeOut();  
        }  
    }  
</script>  
</body>
</html>

在此处插入标题
函数handleLoginRequest(xhr,status,args){
如果(args.validationFailed | | |!args.loggedIn){
jQuery('#dialog').effect(“shake”,{times:3},100);
}否则{
dlg.hide();
jQuery(“#loginLink”).fadeOut();
}  
}  

尝试更改
xmlns:f=”http://java.sun.com/jsf/html“
to
xmlns:f=”http://java.sun.com/jsf/core“>

<?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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
</head>
<body>
<h:outputLink id="loginLink" value="javascript:void(0)" onclick="dlg.show()" title="login">     
    <p:graphicImage value="/images/login.png" />  
</h:outputLink>  

<p:growl id="growl" showDetail="true" life="3000" />  

<p:dialog id="dialog" header="Login" widgetVar="dlg">  
    <h:form>  

        <h:panelGrid columns="2" cellpadding="5">  
            <h:outputLabel for="username" value="Username:" />  
            <p:inputText value="#{loginBean.username}"   
                    id="username" required="true" label="username" />  

            <h:outputLabel for="password" value="Password:" />  
            <h:inputSecret value="#{loginBean.password}"   
                    id="password" required="true" label="password" />  

            <f:facet name="footer">  
                <p:commandButton id="loginButton" value="Login" update=":growl"   
                    actionListener="#{loginBean.login}"   
                    oncomplete="handleLoginRequest(xhr, status, args)"/>  
            </f:facet>

        </h:panelGrid>  

    </h:form>  
</p:dialog>  

<script type="text/javascript">  
    function handleLoginRequest(xhr, status, args) {  
        if(args.validationFailed || !args.loggedIn) {  
            jQuery('#dialog').effect("shake", { times:3 }, 100);  
        } else {  
            dlg.hide();  
            jQuery('#loginLink').fadeOut();  
        }  
    }  
</script>  
</body>
</html>