• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Passing attributes to custom component

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm building a custom component by extending the UIComponentBase class and overriding the encodeAll method to generate html output. This component is added to my custom taglib so now I can call the component in my facelet with:

I would like to pass some attributes to this component, like this:

When I do this I get the error message 'The attribute root is not defined in the component's interface'. I know where to define these attributes when creating a composite custom component (<composite:interface>), but where can I define these attributes in my case? Unfortunately my google search did not help me since most custom component tutorials are about composite components.
 
Saloon Keeper
Posts: 27763
196
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
Is this a fatal message, or just a complaint in the log?

In basic JSP tags, you had to define the attributes in a TLD file. In basic JSF - well, I forget, but I think it was slightly different. When using Facelets, the rules changed again, but the error message became only a message instead of a full-blown error.
 
Robe Eleckers
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, it was a fatal message. Also generated a stacktrace when running the project. I fixed it now by implementing my own UIComponentELTag, to this implementation I added a property which is now set. My taglib had to be changed for this, now it looks like:

So the good thing is it works, however I feel it's more work now than really necessary. Are there perhaps any annotations which can help with this configuration?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic