Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the difference between cfproperty tag defined variable and the variables scope variable in coldfusion?

What is the difference between cfproperty tag defined variable and the variables scope variable in ColdFusion?

I have Java language experience, can you compare the ColdFusion cfproperty variable, variables scope variable to the Java instance variable and class variable?

greate thanks!

like image 600
user133580 Avatar asked Jul 09 '09 08:07

user133580


2 Answers

CFPROPERTY is only useful for providing metadata for a component. The only time I ever use them is when creating a component for a Web Service, when they're required.

Here's a TechNote which discusses CFPROPERTY a bit further: http://kb2.adobe.com/cps/191/tn_19169.html

The variables scope is "protected" and only available within the component. The "this" scope variables are public properties. And, of course, any variable declared with the "var" keyword is private to that method.

Here's some more on component scopes: http://www.hemtalreja.com/?p=94

like image 108
ale Avatar answered Nov 09 '22 23:11

ale


Note: cfproperty tag does NOT defined variables.

However, it is helpful when you use CFC Explorer (browse to the CFC directly), so that you can see the properties of the CFC object.

FYI... cfproperty will be much more useful in CF9. See: ORM - Rethinking ColdFusion Database Integration

like image 32
Henry Avatar answered Nov 10 '22 00:11

Henry