File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Difference between property and attribute ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference between property and attribute ?" Watch "Difference between property and attribute ?" New topic
Author

Difference between property and attribute ?

ram kumar
Ranch Hand

Joined: May 22, 2008
Posts: 146
Hi pals,

I went on thru tiles with struts, there is something called as property and some thing called as attributes !

Could some one explain me just the

#general meaning of Attribute and Property - using the same example for both !

#More specific meaning of Attribute and Property in terms of a java class - using a same example for both !


I need your ideas and suggestions on when to call some thing as an attribute and some thing as property !

Please help me find a resolution on this !



Discussion - the powerfull way to excellence!
Abhinav Srivastava
Ranch Hand

Joined: Nov 19, 2002
Posts: 349

I don't think there is any "universally" accepted definition of these terms. However, a property "in general" is accessible via JavaBean conventions. i.e. a property "name" would mean getName() and setName() are available and vice-versa. You still have two more amibguous terms Attributes and Fields.
Here is an opinion on this subject, but again, its just an opinion.
link
ram kumar
Ranch Hand

Joined: May 22, 2008
Posts: 146
Originally posted by Abhinav Srivastava:
I don't think there is any "universally" accepted definition of these terms. However, a property "in general" is accessible via JavaBean conventions. i.e. a property "name" would mean getName() and setName() are available and vice-versa. You still have two more amibguous terms Attributes and Fields.
Here is an opinion on this subject, but again, its just an opinion.
link



Yes ! Read that already ! Any how cool , let me take a property to be a property and an attribute to be an attribute.


For My understanding i would just say an attribute is extensible

in an xml file

taking the example of

xml file - attribute
.properties file - property



is a possible notion of saying coke is a drink type from coca cola company limited.

"coca-cola" -super tag
"coke" sub tag of coca cola.

while the same is not possible with a property file.(.properties file)

While the getters and setters are possible in both cases.

we have some thing called as request.setAttribute() in servlet tech. :roll:

Hope ! this would do better ! if there is no proper notion of understanding for these terms.
Stephen Davies
Ranch Hand

Joined: Jul 23, 2008
Posts: 352
Without getting too worried about the definitions, I would say that a property (of a class) is as stated above, a variable or primitive type declared in the class, where as an attribute is anything associated with that class be it a variable or method, so it perhaps is possible to suggest a property is an attribute?

Just a stab


be a well encapsulated person, don't expose your privates, unless you public void getWife()!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between property and attribute ?
 
Similar Threads
retrieving object hierarchy - many-to-one?
Need Tips for JSP EL
Dynamic Dropdowns
a few questions about RMI
scriptless jsp question