I have seen many times developers just write code in listener without comparing what action was taken on user interface component.
In this case , I am talking about ADF Faces Dialog component. I am executing the logic only if OK button is clicked.
<af:dialog id="dialog1"dialogListener="#{Bean.method}"/>public void method(DialogEvent event{// okCancel dialogif (event.getOutcome().equals(DialogEvent.Outcome.ok)){//Logic}}