function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shailesh DeshpandeShailesh Deshpande 

ApexPages,Message, apex:pageMessages,apex:PageMessage,apex:Message,apex:Messages

Can anybody tell me the difference betwwen the two classes and the 4 components with examples?..i looked into the documentation...but the information provided seems too less...

 

 

Thanks in Advance.

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

apex:PageMessages is a containing component where any messages that have been added to the page will appear.

 

apex:pageMessage is a component that adds a single message to the page.

 

apex:message allows you to associate a message with a component

 

I've not used apex:messages - I can't see how it particularly differs from apex:pagemessages

 

ApexPages.Message is the class that is used to model a message.  A message isn't associated with a page until it is added via the ApexPages class.

 

ApexPages is a class that allows you to access the current page (through ApexPages.CurrentPage()) and manage messages for the current page.

 

I'd start off adding an apex:pageMessages component to the top of your page and then add some messages in programmatically via the ApexPages methods - that should help clarify things.

 

 

All Answers

bob_buzzardbob_buzzard

apex:PageMessages is a containing component where any messages that have been added to the page will appear.

 

apex:pageMessage is a component that adds a single message to the page.

 

apex:message allows you to associate a message with a component

 

I've not used apex:messages - I can't see how it particularly differs from apex:pagemessages

 

ApexPages.Message is the class that is used to model a message.  A message isn't associated with a page until it is added via the ApexPages class.

 

ApexPages is a class that allows you to access the current page (through ApexPages.CurrentPage()) and manage messages for the current page.

 

I'd start off adding an apex:pageMessages component to the top of your page and then add some messages in programmatically via the ApexPages methods - that should help clarify things.

 

 

This was selected as the best answer
VarunYagain.ax1323VarunYagain.ax1323

Bob/Anyone, with Apex:PageMessage, would you happen to note that the severity levels ('Sucess', 'Error', so on) do not get translated when placed at the top of the page? The same thing works when the message is placed next to the field. Any known bugs? Alternatives?

 

Many thanks,

Varun.