您可以使用创建打印行函数cffunction
并使用它cfif
来检查值的长度是否超过 0。即
确保您实际上也表示 null,请参阅http://www.bennadel.com/blog/1654-Learning-ColdFusion-9-IsNull-And-Working-With-NULL-Values.htm
例子
<cffunction name="PrintLine" returntype="void">
<cfargument name="Value" />
<cfif len(arguments.Value) GT 0>
<cfoutput>#arguments.Value#<br /></cfoutput>
</cfif>
</cffunction>
或从函数返回:-
<cffunction name="PrintLine2" returntype="string">
<cfargument name="Value" />
<cfset var foo = "" />
<cfif len(trim(arguments.Value)) GT 0>
<cfset foo = arguments.Value & "</br />" />
</cfif>
<cfreturn foo />
</cffunction>
可以根据需要添加您的返回类型/提示/必需属性
文档
请参阅http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_f_21.html
和
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_i_01.html
然后你可以这样做: -
<td>
<cfoutput>
#PrintLine(getMeeting.meetingDemographicsAddressLine1)#
#PrintLine(getMeeting.meetingDemographicsAddressLine2)#
#getMeeting.meetingDemographicsCity#
</cfoutput>
</td>