0
這裏是我的代碼的Util類如何使用jsf/primefaces刪除默認消息並放置所需的消息?
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);
這裏是打印默認消息 有人可以PLZ幫我
<h:messages infoStyle="color:green;" showDetail="false" />
我的消息,我越來越喜歡印插入.Successfully我希望我的消息顯示在面板上,然後通過顯示成功或失敗消息消失
這是在執行操作時被調用的方法,並且正在打印我的su通過這種方法獲取並接收失敗消息
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";
}
我不是究竟你在這裏需要明確。你能否更好地解釋它? – Adarsh
@adarsh:我得到一個像點成功的消息的默認消息我希望我的消息顯示成功保存了一段時間在面板上的綠色和消失 – user3227175
你是什麼意思默認消息點成功的消息? – Adarsh