Sample Code:
Visualforce page:
Visualforce page:
- <apex:page controller=“Sample”>
- <apex:form >
- <apex:pageBlock >
- <apex:pageMessages />
- Testing Page Message
- <apex:pageBlockButtons location=“bottom”>
- <apex:commandButton value=“Call” action=“{!check}”/>
- </apex:pageBlockButtons>
- </apex:pageBlock>
- </apex:form>
- </apex:page>
Apex Class:
- public class Sample {
- public Sample() {
- }
- public void check() {
- ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,‘Check button is clicked’));
- }
- }
Output: