![MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual Download Page 310](http://html1.mh-extra.com/html/macromedia/coldfusion-4-5-developing-web/coldfusion-4-5-developing-web_develop-manual_3286369310.webp)
284
Developing Web Applications with ColdFusion
your
CustomTag
object. If you wish to store data and/or objects that are accessible to all
instances of your
CustomTag
you should use
static
data members.
Calling the CFX from a ColdFusion Template
You call Java CFXs from within ColdFusion templates by using the name of the CFX.
The following CFML template calls the
HelloColdFusion
custom tag:
<HTML>
<BODY>
4
<CFX_HelloColdFusion NAME="Les">
</BODY>
</HTML>
To test the CFX
:
1.
Create a new source file in your editor and enter the code displayed above.
2.
Save the file in a directory configured to serve ColdFusion templates. For example,
you might save the file as
c:\inetpub\wwwroot\cfdocs\testjavacfx.cfm
on
Windows NT or
/home/docroot/cfdocs/testjavacfx.cfm
on UNIX.
3.
Request the template from your web browser using the appropriate URL, for
example
http://localhost/cfdocs/testjavacfx.cfm
ColdFusion processes the template and returns a page that displays the text "Hello,
Robert." If an error is returned instead, check the source code to make sure you have
entered it correctly.
ZipBrowser Example
The following example illustrates the use of the
Request
,
Response
, and
Query
objects.
The example uses the
java.util.zip
package to implement a Java CFX called
ZipBrowser,
which is a zip file browsing tag.
The fully qualified path of the zip archive to browse is specified using the
ARCHIVE
attribute. The name of the query to return to the calling page is specified using the
NAME
attribute. The query returned contains three columns: Name, Size, and
Compressed.
For example, to query an archive at the path
c:\logfiles.zip
for its contents and to
output the results you would use the following CFML code:
<CFX_ZipBrowser
ARCHIVE="c:\logfiles.zip"
NAME="LogFiles" >
<CFOUTPUT QUERY="LogFiles">
#Name#, #Size#, #Compressed# <BR>
</CFOUTPUT>
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...