Sample Code:
Visualforce Page:
<apex:page standardController=”Account” extensions=”Sample”>
<apex:form >
<apex:pageMessage rendered=”{!NOT(updateBool)}” severity=”info”>Insert</apex:pageMessage>
<apex:pageMessage rendered=”{!updateBool}” severity=”info”>Update</apex:pageMessage>
</apex:form>
Visualforce Page:
<apex:page standardController=”Account” extensions=”Sample”>
<apex:form >
<apex:pageMessage rendered=”{!NOT(updateBool)}” severity=”info”>Insert</apex:pageMessage>
<apex:pageMessage rendered=”{!updateBool}” severity=”info”>Update</apex:pageMessage>
</apex:form>
</apex:page>
Apex Class:
public class Sample {
public Boolean updateBool {get;set;}
public Sample(ApexPages.StandardController controller) {
Account a = (Account)controller.getRecord();
updateBool = a.Id == null ? false : true;
}
}
Cheers!!!