I have a visualforce page with custom controller. I have added apex:pagemessages tag below pageblock. I have a method say method1 which updates a record in obj A which inturn updates obj B via trigger. But a validation rule in obj B fails.
My code is as follows:
public void method1(){
try{
update rec;
}
catch(System.DmlException e){
ApexPages.Message msg = new apexPages.Message(Apexpages.Severity.ERROR, e.getdmlMessage(0));
ApexPages.addMessage(msg);
}
}
But this error message is not shown in vf page. This error is seen as excpetion in the debug logs.
method1
? Are you rerendering the page message component there?