• Post Reply Bookmark Topic Watch Topic
  • New Topic

Add a custom attribute

 
Babar Qadri
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to add a custom attribute in Textarea Component. I have made a component class by extending HtmlInputTextarea, a tag class, add that attribute in both the classes, made setter/getter for that attribute, add that attribute in .tld file. Now when I run the page, using that custom component, I am getting the value of that attribute inside setter in tag class but setter in my component class is not being invoked.

What else I need to do? Please help.

Thanks.
 
Tim Holloway
Bartender
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a fundamental constraint on JSP custom tags - you can neither add to nor remove from a tag's attribute set as defined in the TLD. The closest you can get is to subclass the taglibrary class you're interested in.

You evidently did that, but it appears that you didn't setup your new tag's TLD properly. Either that or you misdefined the property setter (didn't make it public, didn't capitalize the name properly etc.).
 
Babar Qadri
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tim Holloway:
You evidently did that, but it appears that you didn't setup your new tag's TLD properly. Either that or you misdefined the property setter (didn't make it public, didn't capitalize the name properly etc.).


Thanks Holloway.

Below is my .tld entry under <tag> element


Below is my setter, defined in class HtmlInputTextarea extends javax.faces.component.html.HtmlInputTextarea



Tag method is working good, as I have mentioned in my previous post. Kindly put some more thoughts because thought works.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!