I have to show a message on top of a visual force on load page,if certain conditions are met.
I know 2 ways:
1) in the constructor:
if (Querycondition){
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Warning,'warning description')
}
2) use action attribute of apex:page
<apex:page standardController="Account" action="{!CheckValidation}">
and in the controller:
public PageReference CheckValidation(){
if (Querycondition){
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Warning,'warning description')
}
return null;
}
Is there some difference in terms of performance?
Thanks in advantage for any advice.