Jul 25, 2012

How to use FacesMessage component in ADF

FacesMessage component is used to show confirmation, warning, information and error message .In this tutorial, you will see that how to use FacesMessage component to show any confirmation, information, warning or any error. Suppose you want to show a confirmation when you save your records, here we use FacesMessage.

Managed Bean Code to use FacesMessage(Information)

Add this following code in any method(or method action).

String msg ="Record Saved Successfully!";
FacesMessage message = new FacesMessage(msg); message.setSeverity(FacesMessage.SEVERITY_INFO);
FacesContext fc = FacesContext.getCurrentInstance();
fc.addMessage(null, message);



 To use for Error and Warning just change

 FacesMessage.SEVERITY_INFO or SEVERITY_ERROR or SEVERITY_WARN.

It will look like this
You can change your Message accordingly.


No comments:

Post a Comment