-1

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");
}
4

1 回答 1

-2
<p:messages autoUpdate = "true"/> 

这将解决您显示错误消息的问题:

于 2020-04-29T13:55:40.507 回答