This blog explains about printing error/waring/information messages from backing bean & application module impl class
Step1: Displaying error message from backing bean
Step2: Displaying Information message from backing bean
Step3: Displaying Warning message from backing bean
Step1: Displaying error message from backing bean
import javax.faces.context.FacesContext;
import javax.faces.application.FacesMessage
FacesContext facesContext = FacesContext.getCurrentInstance();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error while Saving","Error while saving")
facesContext.addMessage(null,msg);
Step2: Displaying Information message from backing bean
FacesContext facesContext = FacesContext.getCurrentInstance();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Saved Successfully",
"Saved Successfully")
facesContext.addMessage(null,msg);
Step3: Displaying Warning message from backing bean
FacesContext facesContext = FacesContext.getCurrentInstance();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_WARN, "Saved Successfully",
"Saved Successfully")
facesContext.addMessage(null,msg);
Step4: Displaying Error Messages from Application Module
throw new JboException("Error");
Step5: Displaying Warning message from Application Module
getDBTransaction().addWarning(new JboWarning("Warning"));
No comments:
Post a Comment