FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Hello World", null));This code adds a new FacesMessage to the FacesContext. The first parameter is the client id of the component that the message is associated with, in this example it is set to null to indicate that it is a global message. The second parameter is a FacesMessage object that contains the message text and severity. Package library: javax.faces.context is part of the JavaServer Faces (JSF) library.