• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JSF : Differenc e between attribute and property of a component

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I would really appreciate if any one can let me know what is a property of a component and attribute of a component in jsf world.

In faces-config.xml file we can define information about a component

<!ELEMENT component (description*, display-name*, icon*,
component-type, component-class, attribute*, property*,
component-extension*)>

So what is a attribute of a component and what is property of a component
attribute*,
property*,

<!ELEMENT attribute (description*, display-name*, icon*,
attribute-name, attribute-class, default-value?, suggestedvalue?,
attribute-extension*)>


<!ELEMENT property (description*, display-name*, icon*,
property-name, property-class, default-value?, suggested-value?,
property-extension*)>

Both look very similar

Any inputs or pointers is highly appreciated.

Regards,
Vijay V
 
Author
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Vijay Venkat:
Hi

I would really appreciate if any one can let me know what is a property of a component and attribute of a component in jsf world.
[...]



The core components in JSF are "rendering independant", meaning that they define behavior that is the same no matter how they are rendered. For example, a UICommand component can be rendered as a link or a button, but the behavior is the same. Another examples is a UIInput, which may be rendered as one input field for text input, or as three fields for year, month and day input, or as four fields for credit card number input; the core component behavior is the same no matter how it's rendered.

The rendering and decoding of input for a component is delegated to a separate Renderer attached to the component. So, for instance, if you want a UICommand rendered as a link, you attach a Link renderer; if you want a button, you attach a Button renderer.

With that background, it's easy to describe the distinction between a component "property" and an "attribute".

All rendering independent configuration items for a component are specified as a set of regular bean properties, i.e., by type-safe get and set methods. For the UICommand component, "action" is one example, used to bind the component to a method invoked when the command is triggered.

All rendering dependent configuration items are specified as generic attributes, represented by entries in an attributes Map that the Renderer attached to the component reads. UICommand/Button examples are "alt", "disabled", "style", and all the other HTML attributes that are supported by an HTML <input type="submit"> element. Using generic attributes for rendering dependent stuff makes it easy to develop new Renderers that need new configuration items, because the component class doesn't have to be modified with new bean get/set methods.
[ June 12, 2004: Message edited by: Hans Bergsten ]
 
Vijay Venkat
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hans thanks for the clear explanation
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic