1

我正在尝试让 Primefaces 3.5 密码匹配工作,但我不断收到一条错误消息,提示“有一些未处理的 FacesMessages”,并且没有按预期显示正确的消息。

我创建了一个非常简单的页面,并从 Showcase 复制'n'粘贴代码以尝试消除所有其他可能的原因,但问题仍然存在。这是非常简单的页面:

<!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:p="http://primefaces.org/ui">
<h:head>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
    <title>Primefaces Password Match Test</title>
    <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/css/custom.css" />
</h:head>
<h:body>
    <h:form id="form"> 
        <p:panel header="Match Mode">  
            <p:messages id="messages" showDetail="true" autoUpdate="true"/>
            <h:panelGrid columns="2" id="matchGrid">                     
                <h:outputLabel for="pwd1" value="Password 1: *" />  
                <p:password id="pwd1" value="#{passwordBean.password5}" match="pwd2" label="Password 1" required="true"/>
                <h:outputLabel for="pwd2" value="Password 2: *" />  
                <p:password id="pwd2" value="#{passwordBean.password5}" label="Password 2" required="true"/>  
            </h:panelGrid> 
            <p:commandButton id="saveButton" update="matchGrid" value="Save" />  
        </p:panel>  
    </h:form> 
</h:body>
</html>

我使用的 bean 是 Showcases bean 的精确副本。

这是我在输入不同的密码并单击保存后在控制台中看到的内容:

[14/05/13 12:41:02:481 EST] 000000ee srt           W com.ibm.ws.webcontainer.srt.SRTServletResponse setIntHeader SRVE8094W: WARNING: Cannot set header. Response already committed.
[14/05/13 12:41:02:633 EST] 000000e8 srt           W com.ibm.ws.webcontainer.srt.SRTServletResponse setIntHeader SRVE8094W: WARNING: Cannot set header. Response already committed.
[14/05/13 12:41:09:371 EST] 000000e9 RenderRespons W   There are some unhandled FacesMessages, this means not every FacesMessage had a chance to be rendered.
These unhandled FacesMessages are: 
- Password 1 should match with Password 2.
[14/05/13 12:41:09:352 EST] 000000e9 SystemErr     R 10999369 [WebContainer : 1] INFO org.apache.bval.jsr303.ConfigurationImpl - ignoreXmlConfiguration == true
4

1 回答 1

1

而不是更新 matchGrid 更新表单。使用更新=@form

于 2013-05-14T13:02:29.840 回答