component in Visualforce Page
The <apex:pageMessage> is another important component that is mainly used for displaying all the success, error, and warning messages of all the components that are presented using SF styling on the current page.
We use the <apex: pageMessage> component when we need to display the individual message on the VF page. In the <apex: pageMessage> component, we provide the message which we want to display on the page, so it is a kind of static message.
Just like the <apex: page> component, the <apex:pageMessage> component also has some attributes which are used when this component is used on the page. These attributes are as follows:
The id attribute is of type string, i.e., a unique identifier that is used for allowing the component to be referenced by other components on the page.
The detail attribute is of type string that is used for defining the detailed description of the information.
The escape attribute is of type Boolean that is used for specifying whether the sensitive HTML and XML characters should be escaped in the HTML output generated by the component or not.
The rendered attribute is of type Boolean that is used for specifying whether the component is rendered on the page or not. By default, its value is set to true.
The severity attribute is of type string that is used for specifying the severity of the message. Confirm, info, warning, and error are the supported values for this attribute.
The strength attribute is of type integer that is used for specifying the strength of the message for controlling the visibility and icon size displayed next to the message. If we don't want to use an image, we set its value to 0. We set its value to 1-3, i.e., highest strength and largest icon.
The summary attribute is similar to the detail attribute of the component that is used for defining the summary message.
The title attribute is of type string that is used for defining the title text for the message.
Let's take an example to understand how we can use the <apex: pageMessage> component in the VF page: