• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Add a custom attribute

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 25477
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
When evil is afoot and you don't have any arms you gotta be hip and do the legwork, but always kick some ... tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic