FacesMessage is used to show confirmation, warning, information messages .In this tutorial, you will see that how to use FacesMessage to show any information, warning or any error messages. Suppose you want to show a confirmation when you save your records, here we use FacesMessage.
Managed Bean Code to use FacesMessage(Information)-
FacesMessage Message = new FacesMessage("Record Saved Successfully!");
Message.setSeverity(FacesMessage.SEVERITY_INFO);
FacesContext fc = FacesContext.getCurrentInstance();
fc.addMessage(null, Message);
To use for Error and Warning just change FacesMessage.SEVERITY_INFO to SEVERITY_ERROR or SEVERITY_WARN.
It will look like this
You can change your Message accordingly
No comments:
Post a Comment