ApexPages Class
Use ApexPages to add and check for messages associated with the current page, as well as to reference the current page.
In addition, ApexPages is used as a namespace for the PageReference Class and the Message Class.
The following are methods for ApexPages. All are instance methods.
-
Add a message to the current page context.
-
Adds a list of messages to the current page context based on a thrown exception.
-
Returns the current page’s PageReference.
-
Returns a list of the messages associated with the current context.
-
Returns
trueif there are messages associated with the current context,falseotherwise. -
Returns
trueif messages of the specified severity exist,falseotherwise.
Add a message to the current page context.
public Void addMessage(ApexPages.Message message)
- message: Type: ApexPages.Message
Type: Void
Adds a list of messages to the current page context based on a thrown exception.
public Void addMessages(Exception exceptionThrown)
-
exceptionThrown:
Type: Exception
Type: Void
Returns the current page’s PageReference.
public System.PageReference currentPage()
Type: System.PageReference
This code segment returns the id parameter of the current page.
Returns a list of the messages associated with the current context.
public ApexPages.Message[] getMessages()
Type: ApexPages.Message[]
Returns true if there are messages associated with the current context, false otherwise.
public Boolean hasMessages()
Type: Boolean
Returns true if messages of the specified severity exist, false otherwise.
public Boolean hasMessages(ApexPages.Severity severity)
-
sev:
Type: ApexPages.Severity
Type: Boolean