Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Add a custom attribute

 
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.
 
Saloon Keeper
Posts: 22012
151
Android Eclipse IDE Tomcat Server Redhat Java 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.
 
Remember to always leap before you look. But always take the time to smell the tiny ads:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic