I know about startElement, endElement, and writeAttribute methods on ResponseWriter. My problem is that I want to for example output a h:commandLink by declaring it like HtmlCommandLink link = new HtmlCommandLink();
.
How can I output other UIComponents like this in my own component? I might want to use some RichFaces ajax stuff in my components aswell so hoping I can avoid making it all by scratch.
Edit: What I'm trying to do is create my own tag library with the following tag <myTags:commentTree>
. Every comment have a reply button, when the reply button is clicked I render the reply form beneath the comment. Once that is rendered, I would like to output for example the richfaces <a4j:commandButton>
component. This have to be done inside my own java tag file which Ive called for CommentsTreeUI.java
.
Normally I output all my elements that display the forms and buttons with writer.startElement("input", myComponent); writer.writeAttribute("type", "button", null);
but if I could instead do for example startElement("a4j:commandbutton", myComponent)
that would help my ALOT since it has all the built in ajax features etc.
Any clues?
This problem was solved by adding new components by using
One approach to making composite controls is to use the binding attribute to associate the tag with your own code:
The bean configuration in faces-config.xml:
The bean code:
You can do something like this:
It does depend on what you want to do with the child components though i.e. if you want them surrounded with custom HTML (in an HTML list, for example) you will need something a bit more complex.