Javatpoint Logo
Javatpoint Logo

<apex: message> Component in Visualforce Page

The <apex: message> is another important component for displaying a message(error or warning) for a specific component on the VF page. If we do not specify the <apex: message> component on the VF page, all the error and warning messages will be visible only in debug logs, not in UI.

The <apex: message> component has the following attributes on VF Page:

1. dir

The dir is a string-type attribute used to specify the direction in which the generated HTML component should be read. RTL and LTR are the two possible values for this attribute.

Syntax:

2. for

The for is a string-type attribute used for specifying the Id of the component with which the message should be associated.

Syntax:

3. id

The id is a string-type attribute, i.e., a unique identifier that allows this component to be referenced by other components on the page.

Syntax:

4. lang

The lang is a string-type attribute used for specifying the base language for the generated HTML output. The "en" and "en-US" are the two possible values for this attribute.

Syntax:

5. rendered

The rendered is a Boolean-type attribute used to specify whether this component should be rendered on the page. The boolean value true is set as a default value for this attribute.

Syntax:

6. style

The style is a string-type attribute used for specifying the inline CSS applied on this component to display the message.

Syntax:

7. styleClass

The styleClass is a string-type attribute used to specify the CSS stylesheet applied on this component to display the message.

Syntax:

8. title

The title is a string-type attribute used to specify the text displayed when the mouse pointer hovers over this component.

Syntax:

Let's take an example to understand how we can use this component on the VF page:

ApexMessageExample.vfp

ApexMessageExampleController.apxc

Output

<apex: message> Component in Visualforce Page





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA