h:messages does not display messages when p:commandButton is pressed

前端 未结 1 625
太阳男子
太阳男子 2020-11-28 12:03

I have a problem with the h:messages tag in JSF that simply does not show any messages. In the Glassfish log are no errors when I click the button. The setup is as follows:

1条回答
  •  难免孤独
    2020-11-28 12:57

    You're sending an ajax request with PrimeFaces . Ajax requests have by default no form of feedback (unless PrimeFaces' autoUpdate="true" is been used somewhere). You should be explicitly specifying parts of the view which you'd like to update on ajax response.

    One way is specifying the update attribute on to point to the client ID of the component.

    
             
        
    
    

    Another way is to replace it by PrimeFaces which has an autoUpdate attribute for the purpose of automatic update on ajax response.

    
             
        
    
    

    A completely different alternative is to turn off ajax by adding ajax="false" attribute to the button, this way a synchronous postback will be performed which effectively results in a full page update, exactly like as how the standard JSF behaves when used without .

    
             
        
    
    

    See also:

    • Understanding PrimeFaces process/update and JSF f:ajax execute/render attributes

    0 讨论(0)
提交回复
热议问题