2013-05-14 16 views
1

我想要Primefaces 3.5密碼匹配工作,我不斷收到一個錯誤,說「有一些未處理的FacesMessages」,並沒有按預期顯示適當的消息。Primefaces密碼匹配未處理的消息

我已經創建了一個非常簡單的頁面,並複製了'Show'代碼以嘗試消除所有其他可能的原因,但問題仍在發生。這裏是非常簡單的頁面:

<!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> 

我使用的豆是展櫃豆的精確副本。

這是我看到在控制檯中輸入不同的密碼,然後點擊保存後:

[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 

回答

1

而非更新matchGrid更新的形式。 使用update = @表格

+0

你是對的Sagar,並且你在Showcase代碼中發現錯誤。很顯然,你已經指出了它:p:messages標記在panelGrid之外,這就是更新panelGrid不會影響p:messages的原因。對於比使用update = @表單更有針對性的方法,我們可以像這樣指定p:messages標記的標識:update =「messages」。謝謝你的幫助。 – Martin 2013-05-16 00:20:15