我想在数据表中的行编辑上调用此方法后显示成功消息,但它没有显示给我。请帮助
public String onRowEdit(RowEditEvent event) {
FacesMessage msg = new FacesMessage(((SearchMaintenanceFields) event.getObject()).getFieldName(), "has been updated Successfully");
FacesContext.getCurrentInstance().addMessage(null, msg);
setUpdateFlag(true);
return "searchMaintenance.xhtml?faces-redirect=true";
}
<p:ajax event="rowEdit" onstart="PF('dlg').show();" oncomplete="PF('dlg').hide();" listener="#{vaultSearchMaintenanceFields.onRowEdit}"
update="fieldListTable" />
我保留此ajax调用的数据表的fieldListTable id
答案 0 :(得分:0)
此代码对我有用:
public void addMessage(String summary, FacesMessage.Severity severity) {
FacesMessage message = new FacesMessage(severity, summary, null);
FacesContext.getCurrentInstance().addMessage(null, message);
}