0 Replies Latest reply on Mar 22, 2009 6:41 PM by jk;l jkl;

    Where to initialize JSF component?

    jk;l jkl; Expert

      Where's the correct place to initialize a JSF custom component? I've got a custom subclass of HtmlDataTable, and need to set the 'var' variable to something. However, when 'var' isn't specified in the tag, neither setVar nor getVar are called, so overriding either of those methods won't work.


      The solution is therefore to explicitly call super.setVar from somewhere, but I'm not sure from where. This isn't the only thing I'd need to initialize - I'd also need to add children components, facets, etc.


      But the only place I really see I have the ability to initialize these components is in the component's getters and setters - I could see that working, but there are some things I'd need to initialize all at once at the very beginning, rather than on a per-attribute basis.


      Where could I do this - it's not like a Seam component that has a @Create annotation or something like that. I can't initialize using initializers or a constructor, because the initialization depends on the setters from attributes in the Facelet tag getting called first.