164
Chapter 8: Reusing Code in ColdFusion Pages
About reusable CFML elements
ColdFusion provides you with several types of reusable elements, sections of code that you can
create once and use multiple times in an application. Many of these elements also let you extend
the built-in capabilities of ColdFusion. ColdFusion provides the following reusable CFML
elements:
•
ColdFusion pages you include using the
cfinclude
tag
•
User-defined functions (UDFs)
•
Custom CFML tags
•
CFX (ColdFusion Extension) tags
•
ColdFusion components
The following sections describe the features of each of these elements and provide guidelines for
determining which of these tools to use in your application. Other chapters describe the tools in
detail. The last section in this chapter includes a table that helps you chose among these
techniques for different purposes.
ColdFusion can also use elements developed using other technologies, including the following:
•
JSP tags from JSP tag libraries
For information on using JSP tags, see
Chapter 33, “Integrating J2EE and Java Elements in
CFML Applications,” on page 735
.
•
Java objects, including objects in the Java runtime environment and JavaBeans
For information on using Java objects, see
Chapter 33, “Integrating J2EE and Java Elements in
CFML Applications,” on page 735
.
•
Microsoft COM (Component Object Model) objects
For information on using COM objects, see
Chapter 34, “Integrating COM and CORBA
Objects in CFML Applications,” on page 761
.
•
CORBA (Common Object Request Broker Architecture) objects
For information on using CORBA objects, see
Chapter 34, “Integrating COM and CORBA
Objects in CFML Applications,” on page 761
.
•
Web services
For information on using web services, see
Chapter 32, “Using Web Services,” on page 707
Including pages with the cfinclude tag
The
cfinclude
tag adds the contents of a ColdFusion page to another ColdFusion page, as if the
code on the included page were part of the page that uses the
cfinclude
tag. It lets you pursue a
“write once use multiple times” strategy for ColdFusion elements that you incorporate in multiple
pages. Instead of copying and maintaining the same code on multiple pages, you can store the
code in one page and then refer to it in many pages. For example, the
cfinclude
tag is
commonly used to put a header and footer on multiple pages. This way, if you change the header
or footer design, you only change the contents of a single file.
Содержание COLDFUSION MX 61-DEVELOPING COLDFUSION MX
Страница 1: ...Developing ColdFusion MX Applications...
Страница 22: ...22 Contents...
Страница 38: ......
Страница 52: ...52 Chapter 2 Elements of CFML...
Страница 162: ......
Страница 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Страница 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Страница 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Страница 266: ......
Страница 314: ...314 Chapter 14 Handling Errors...
Страница 344: ...344 Chapter 15 Using Persistent Data and Locking...
Страница 349: ...About user security 349...
Страница 357: ...Security scenarios 357...
Страница 370: ...370 Chapter 16 Securing Applications...
Страница 388: ...388 Chapter 17 Developing Globalized Applications...
Страница 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Страница 410: ......
Страница 426: ...426 Chapter 19 Introduction to Databases and SQL...
Страница 476: ...476 Chapter 22 Using Query of Queries...
Страница 534: ...534 Chapter 24 Building a Search Interface...
Страница 556: ...556 Chapter 25 Using Verity Search Expressions...
Страница 558: ......
Страница 582: ...582 Chapter 26 Retrieving and Formatting Data...
Страница 668: ......
Страница 734: ...734 Chapter 32 Using Web Services...
Страница 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Страница 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Страница 788: ......
Страница 806: ...806 Chapter 35 Sending and Receiving E Mail...