-1

JsfUtil addErrorMessage is not working while calling ajax function to bean method..

<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 method:

public void salaryPromotion() throws ParseException{
    JsfUtil.addErrorMessage("New salary should be greater than current salary");
}
LaurentG
  • 11,128
  • 9
  • 51
  • 66
  • What is `JsfUtil`? What is not working? Do you get an exception? You have to tell more. – LaurentG Oct 29 '13 at 07:01
  • I'm not seeing anywhere in the code that you've declared a message component and that you're referencing it in ``. Why/how exactly are you expecting that the message would show up? – BalusC Oct 29 '13 at 10:56
  • JsfUtil.addErrorMessage function is working fine.When i'm not using ajax.but when i'm using ajax listener function to call bean method that time this message function is not show up the message.I'm not getting nothing exception also working fine other work.but message only not dispaly.For example if i enter the current salary should be greater than new salary amount that time i want to show message. – silambarasan Oct 30 '13 at 05:11

1 Answers1

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

This would resolve your issue for the error messages to be displayed:

anup9
  • 29
  • 4
  • This is already in the duplicate. Please read that first before adding not really new answer (content wise) – Kukeltje May 01 '20 at 17:32