Book Image

Learning Apex Programming

5 (1)
Book Image

Learning Apex Programming

5 (1)

Overview of this book

Table of Contents (17 chapters)
Learning Apex Programming
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Visualforce components


Once you have mastered the use of Visualforce pages, you will have probably written many useful snippets of markup that you use over and over. While it's easy to just copy and paste these snippets, you can be more efficient and take advantage of Visualforce components. Components are stored snippets of Visualforce markup that you can reference multiple times in a single page or across multiple pages.

You can create a Visualforce component in the Force.com IDE as follows:

  1. Right-click on your project and navigate to New | Visualforce Component. The Create New Visualforce Component window appears, as shown in the following screenshot:

  2. Enter the label and name for your new component. For this example, use myComponent.

  3. Select the API version for the page. For this example, keep it at the default value.

  4. Click on Finish. A progress bar will appear followed by your new Visualforce component.

Just like pages, components can include HTML, CSS, JavaScript, and Visualforce tags. They...