Custom Visualforce Component Definition | DEV-501 Exam Question Answer

Custom Visualforce Component Definition

Question

A custom Visualforce component.

All custom component definitions must be wrapped inside a single <apex:component> tag.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

D.

The correct answer is D. apex:component.

Explanation: A custom Visualforce component is a reusable piece of UI that can be included on multiple pages or within other components. To define a custom component, you must wrap the component definition inside a single <apex:component> tag.

The <apex:component> tag is the root tag of a Visualforce component. It contains metadata about the component, such as its name and description. It also contains the markup that defines the component's UI.

Here's an example of a simple custom component that displays a message:

php
<apex:component> <h1>Hello, World!</h1> </apex:component>

You can then include this component on a Visualforce page using the <apex:include> tag:

makefile
<apex:page> <apex:include component="HelloWorld" /> </apex:page>

In this example, the component is named "HelloWorld" and is included on a Visualforce page using the <apex:include> tag. When the page is rendered, the component's markup will be displayed, showing the message "Hello, World!".

In conclusion, the correct tag to wrap the definition of a custom Visualforce component is <apex:component>.