ColdFusion isDefined
问题 I am trying to check to see if data exist in my form If data does not exist I want to assign it to O. How can I do this. <cfif not isDefined("FORM.Age")> cfset FORM.Age = "0" <cfif> 回答1: Generally the best practice is considered to be to avoid isDefined. This is because isDefined will search all scopes until it finds a matching variable. So it's more efficient to use structKeyExists, eg: <cfif NOT structKeyExists(form, "age")> <cfset form.age = 0> </cfif> Also, another way to achieve this is