Here is the code my util class
public static void addSuccessMessage(String msg){
FacesMessage facesMsg=new FacesMessage(FacesMessage.SEVERITY_INFO, "Successfully Inserted" , msg);
// FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,"No results found with "));
FacesContext.getCurrentInstance().addMessage("successInfo", facesMsg);
}
public static void addErrorMessage(String msg){
FacesMessage facesMsg=new FacesMessage(FacesMessage.SEVERITY_ERROR,msg,msg);
FacesContext.getCurrentInstance().addMessage(null, facesMsg);
here is the default message that is printed can someone plz help me out
<h:messages infoStyle="color:green;" showDetail="false" />
My message i getting printed like .Successfully inserted i want my message to be in panel for sometime and disappear by Showing success or failur message
this the method that is method that is getting called on performing operation and i am printing my success and failure message through this method
public String updateEmpActn() throws Exception{
if("updated".equals(empapp.updtEmpApp())){
JsfUtil.addSuccessMessage("Successfully Saved");
//i tried putting this also some error of incompatable type is coming
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN,"Successfully Saved"));
return "inserted";
}else{
JsfUtil.addErrorMessage("Not Saved");
return "notinserted";
}