This blog we will see how to display Error/Warning/Information/Exception Messages in backing bean and implementation class.
The below example required for displaying error message from backing bean:
FacesContext facesCntx = FacesContext.getCurrentInstance();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error while Execution","Error while Execution");
facesCntx.addMessage(null,msg);
The below example required for displaying warning message from backing bean:
FacesContext facesCntx = FacesContext.getCurrentInstance();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_WARN, "Execute Successfully", "Execute Successfully");
facesCntx.addMessage(null,msg);
The below example required for displaying information message from backing bean:
FacesContext facesCntx = FacesContext.getCurrentInstance();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Executed Successfully", "Executed Successfully");
facesCntx.addMessage(null,msg);
The below example required for displaying warning message from implementation class:
getDBTransaction().addWarning(new JboWarning("Warning Occur"));
The below example required for displaying exception message from implementation class:
throw new JboException("Exception Occur");
Thanks..
The below example required for displaying error message from backing bean:
FacesContext facesCntx = FacesContext.getCurrentInstance();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error while Execution","Error while Execution");
facesCntx.addMessage(null,msg);
The below example required for displaying warning message from backing bean:
FacesContext facesCntx = FacesContext.getCurrentInstance();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_WARN, "Execute Successfully", "Execute Successfully");
facesCntx.addMessage(null,msg);
The below example required for displaying information message from backing bean:
FacesContext facesCntx = FacesContext.getCurrentInstance();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Executed Successfully", "Executed Successfully");
facesCntx.addMessage(null,msg);
The below example required for displaying warning message from implementation class:
getDBTransaction().addWarning(new JboWarning("Warning Occur"));
The below example required for displaying exception message from implementation class:
throw new JboException("Exception Occur");
Thanks..
No comments:
Post a Comment