show af:message programatically in ADF | Techartifact

Requirment- To show the message in ADF

ADF Faces uses the standard JSF messaging API. JSF supports a built-in framework for messaging by allowing FacesMessage instances to be added to the FacesContext object using the addMessage(java.lang.String clientId, FacesMessage message) method. You can set the type of message like – error, fatal,info,warning.

            FacesContext facesContext = FacesContext.getCurrentInstance();
            facesContext.addMessage("NoRecordsFound", 
                                    new FacesMessage(FacesMessage.SEVERITY_INFO,
                                                     "No Records Found", 
                                                     "No Orders matching searched criteria"));
            facesContext.renderResponse(); 

Happy coding with Techartifact