<apex: define> Component in Visualforce Page

It is one of the most used components on the Visualforce page responsible for providing content for the <apex: insert> component, i.e., defined in the VF page.

We use this method to get input from the user for the controller method that doesn't correspond to a field on a sObject field.

Attributes

The <apex: define> component has only a single attribute, i.e., name.

1. name

The name is a string-type attribute used for specifying the name of the insert component into which the content of this defined component should be read.

Syntax:

Let's take an example to understand how we can use the <apex: define> component on the Visualforce page.

ApexDefineExample.vfp

ApexInsertExample.vfp

Output

apex: define in Visualforce Page