2014-02-13 97 views
0

我已阅读了许多关于类似问题的问题,但无法找到答案。我有这段代码形式内:消息未在AJAX更新中显示

<p:outputPanel id="articleInfo"> 
    <p:growl id="messages" autoUpdate="true"/> 
    <p:panel rendered="#{not empty myBB.selectedProduct}"> 
     <p:panel> 
      <h:outputText escape="false" value="#{myBB.content}"/> 
     </p:panel> 
     <p:commandButton value="Button" update=":mainForm:articleInfo"/>  
    </p:panel> 
</p:panel> 

当我点击一个按钮,在支持bean中生成新的内容和FacesMessage加入这样的:

public String getContent(){ 
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(severity, title, detail)); 
    return "something"; 
} 

阿贾克斯更新很好,因为我看到新内容,addMessage也被称为,但我看不到消息。我试过p:messages而不是咆哮,加入for="mainForm:articleInfo"和调用addMessage用“的MainForm:articleInfo”(我检查了它的在视图中正确的ID

我仍然无法找到一个原因

+0

p:commandButton具有更新属性本身,为什么你使用ajax事件。 – Makky

+0

它实际上是从'''p:tree''复制的,但我想保持代码最小。如果我把它放在commandButton更新属性上,结果是一样的。我已经改变了它,所以它并没有让人困惑。 – NeplatnyUdaj

+0

我没有在cmomand按钮上看到actionListener或动作? – Makky

回答