this article is for you if you are a beginning coder. you know how to do marvelous things like query databases and output the results. you can take data submitted from a form, manipulate it, and perform calculations. after mastering these fundamentals, you are ready to expand your knowledge of coldfusion. this article explains six coldfusion tags that you can easily start using today.
these tags are beyond the basics, are quick to learn, and provide utility. the tags listed here have a brief explanation of their use, a detailed look at the attributes, and an example of use.
the most important tag in this article is cfqueryparam. most of you are not using cfqueryparam - i know, because i have worked on your code! if you take one thing away from this article, please take that tag. but in order to understand cfqueryparam, we should first take a look at cfparam. so lets start there.
cfparam
<cfparam name = "param_name" type = "data_type" default = "value">
at the most basic level of cfparam, it determines whether a variable exists. it can also verify that the variable is of the correct type. if neither of these conditions is met the tag will throw an error, or optionally set the variable to a default value. as it sounds, it can be used in a few different ways. these uses correspond with the attributes, so lets start by taking a look at them.
the first attribute is name. this is the name of the variable whose existence you want to determine. its the only required attribute. if this is the only attribute used, it operates in this way: it checks if a variable of that name exists, and if it doesnt, it throws an error:
<cfparam name="myvariable"> essentially, it is the equivalent of this code <cfif not isdefined("myvariable")> <cfthrow /> </cfif>
the second attri... 下一页