JsfUtil addErrorMessage 在调用 ajax 函数到 bean 方法时不起作用..
<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");
}