Aneesha Govil wrote:
Hi,

I am creating a date component with some additional attributes on top of t:inputdate. Do I need to add only the new attributes to component tag or do I also need to add the attributes already a part of parent HtmlInputDate?

You can subclass the original tag class, which means you do not then need to write java code to handle the original properties.

However in the .tld file there is no way to say that a <tag> element extends another, so in the .tld file entry you do need to copy-and-paste all the attribute definitions from the parent tag. Ecch.

Of course if you can use Facelets instead, all this is much nicer; no tag class or .tld file is required at all.

Note also that it is possible to add new properties to a tag, and use them in a renderer without writing a new component class at all, as every component has an attributes map that can store data, effectively "tunnelling" properties from the tag to the renderer. Sometimes this is useful, and sometimes it is better to create a new component class.

Regards,

Simon

Reply via email to