MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Manual do Utilizador Página 14

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 44
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 13
14 CHAPTER 30 Extending ColdFusion with CFX
3. For the Tag Name field, enter the name of the tag, including the CFX_ part but without
the angle brackets (for this example, you will enter
CFX_HelloWorld). The names of CFX
tags are not case sensitive, so you don’t need to get the capitalization exactly right. That
said, it makes sense to use the same capitalization that you plan to use in your
ColdFusion code.
4. For the Class Name field, enter the name of the class file, but without the .class
extension. This part is case sensitive, so the capitalization you use here must match the
capitalization of the class file (which, in turn, always matches the name of the class as
specified in the Java code itself).
5. If you wish, enter a Description for the tag. The description comes in handy during
development if several people on your team are creating different CFX tags.
6. Click the submit button to register the tag. The tag will now appear in the Registered
CFX Tags list, indicating that it is ready for use in your ColdFusion pages.
Using the New Tag
Now that the <CFX_HelloWorld> tag has been written, compiled, and registered in the ColdFusion
Administrator, it’s ready to be used in your pages. Listing 30.2 shows the code for the simple test
page shown previously in Figure 30.1.
Listing 30.2 HelloWorldDemo.cfm—Using the <CFX_HelloWorld> Ta g
<!---
Filename: HelloWorldDemo.cfm
Author: Nate Weiss (NMW)
Purpose: Demonstrates how to use a CFX tag in a ColdFusion page
--->
<html>
<head>
<title>Using &lt;CFX_HelloWorld&gt;</title>
</head>
<body>
<!--- Invoke the Java CFX tag --->
<CFX_HelloWorld
NAME=”Belinda”
AGE=”19”>
</body>
</html>
A Word on Exceptions
It’s worth noting that the exceptions created by the throw statement in Listing 30.1 become true
ColdFusion exceptions that behave just like exceptions thrown by native CFML tags, or by the
<cfthrow> tag. The look and feel of the error messages can be customized with the <cferror> tag.
Vista de página 13
1 2 ... 9 10 11 12 13 14 15 16 17 18 19 ... 43 44

Comentários a estes Manuais

Sem comentários