在向bean方法调用ajax函数时,JsfUtil addErrorMessage不起作用..
<h:outputLabel value="Effect Date" styleClass="boldFound,rsInput" />
<p:calendar value="#{salarypromotionBean.salarypromotiondto.effectDate}"
pattern="dd-MM-yyyy" yearRange="#{c-100}" navigator="true"
size="21">
<p:ajax event="dateSelect" listener="#{salarypromotionBean.salaryPromotion}" update="emp,empName,empDept,empDesig,empDate"/>
</p:calendar>
<h:outputText value="Employee No" />
<p:selectOneMenu value="#{salarypromotionBean.salarypromotiondto.employeeNo}" id="emp">
<f:selectItem itemLabel="select" itemValue="0" />
<f:selectItems value="#{salarypromotionBean.empid}" />
</p:selectOneMenu>
Java方法:
public void salaryPromotion() throws ParseException{
JsfUtil.addErrorMessage("New salary should be greater than current salary");
}
答案 0 :(得分:-2)
<p:messages autoUpdate = "true"/>
这将解决您的问题,以显示错误消息: