+ Start a Discussion
Ashritha ReddyAshritha Reddy 

Differences

Difference In Between Apex PageMessage, PageMessages and Message VF Pages Tags in Salesforce
Best Answer chosen by Ashritha Reddy
Nagendra Prasad ChNagendra Prasad Ch
Hi Ashtitha,

apex:pageMessage
apex:pageMessage should be used for presenting  only custom messages in the page, for errors, warnings and other types of messages for a given severity.
We have to provide severity and strength for custom messages.
Ref : https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_pageMessage.htm​ (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_pageMessage.htm)
Ex:
        <apex:pageBlock >        
        <apex:pageMessage summary="This pageMessage will always display. Validation error 
           messages appear in the pageMessages component." severity="warning" strength="3" />
        <apex:pageMessages />       
        </apex:pageBlock>

​apex:pageMessages
apex:pageMessages  displays all messages that were generated for all components on the current page, presented using the Salesforce styling.
No need to provide severity and strength. Tekes Salesforce styling.
Ref : https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_pageMessages.htm​
Ex:
        <apex:pageBlock >
        <apex:pageMessages />        
        </apex:pageBlock>

apex:message 
A message for a specific component, such as a warning or error. If an <apex:message> or <apex:messages> component is not included in a page, most warning and error messages are only shown in the debug log.

Ref : https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_message.htm


        
 

All Answers

Siva SakthiSiva Sakthi
Hi Ashritha,

     Refer this Links. It may help you.
1. https://developer.salesforce.com/forums?id=906F00000008xuuIAA
2. http://salesforce.stackexchange.com/questions/8139/difference-between-the-multiple-messaging-options-in-visualforce
3. http://cloudisfuture.blogspot.in/2012/08/difference-in-between-apex-pagemessage.html
4. http://www.infallibletechie.com/2014/01/difference-between-apexpagemessage-and.html   &        http://sfdchackathon.blogspot.in/2015/06/difference-between-and.html

Thanks 
Siva
Nagendra Prasad ChNagendra Prasad Ch
Hi Ashtitha,

apex:pageMessage
apex:pageMessage should be used for presenting  only custom messages in the page, for errors, warnings and other types of messages for a given severity.
We have to provide severity and strength for custom messages.
Ref : https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_pageMessage.htm​ (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_pageMessage.htm)
Ex:
        <apex:pageBlock >        
        <apex:pageMessage summary="This pageMessage will always display. Validation error 
           messages appear in the pageMessages component." severity="warning" strength="3" />
        <apex:pageMessages />       
        </apex:pageBlock>

​apex:pageMessages
apex:pageMessages  displays all messages that were generated for all components on the current page, presented using the Salesforce styling.
No need to provide severity and strength. Tekes Salesforce styling.
Ref : https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_pageMessages.htm​
Ex:
        <apex:pageBlock >
        <apex:pageMessages />        
        </apex:pageBlock>

apex:message 
A message for a specific component, such as a warning or error. If an <apex:message> or <apex:messages> component is not included in a page, most warning and error messages are only shown in the debug log.

Ref : https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_message.htm


        
 
This was selected as the best answer