I'm trying to do something similar using ajax4jsf. The issue I'm having is that my a4j:commandLinks aren't invoking their actions or actionListeners when clicked. The components themselves look fine and render accordingly though. I'm guessing that I'm missing some initialization that needs to be taken care of when I programmatically create the commandLinks but I'm just not sure what that is. If you could give me any hints on how to accomplish this (before I spend hours figuring it out) I would be very grateful.
-John -----Original Message----- From: Aleksei Valikov [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 12, 2006 2:50 AM To: MyFaces Discussion Subject: Re: Run-time component generation Hi. > Aleksei, > This is very interesting what you've done. > The source code would definitely be more enlightening. As far as I understood my management, we won't be releaseing it open source. But of course I can share parts of the code. > How do you do these expanding/contracting panels? They are actually not substracting/contracting. It's dynamic adding/removing of children. That's how it works. [+] and [-] buttons are AjaxCommandLinks with normal images inside of them (see ajax4jsf library for the ajax components). They have bound action handlers which know "their" panels. When the link is clicked, ajax4jsf sends the request to the server and action handler is invoked. The action handler (let's take [+] for instance) then knows that he has to add new controls to his panel. These new controls are built in the runtime and after that added to the corresponding panel. The [+] AjaxCommandLink has its reRender attribute set to its panel id. So after the action handler is invoked on the server side, the panel just gets re-rendered within the page and it showes new controls after that. AJAX with ajax4jsf has actually minimal impact on the processing. ajax4jsf is really very non-intrusive. I can change all AjaxCommandLinks back to HtmlCommandLinks and it will work just as well - with the exception that the whole page will be reloaded on each button click. The "tricky" part here is component creation. Well, it's also not tricky. You just have to do what tags do - instantiate the components, add value/method bindings, add children components or facets. Not too complex. I am currently trying to extract business non-specific and non-critical things into an open-source hifaces.dev.java.net project. Bye. /lexi