users@woodstock.java.net

Re: dynamically adding components to page and Ajax issue

From: autozoom <cioni_mauro_at_yahoo.com>
Date: Mon, 4 Feb 2008 10:12:20 -0800 (PST)

Do you mean to put the whole page bean in session scope?
I will try this, but I don't like it very much...this is actually a quite
complex page with also a large tree and a heavy table, so putting it into
session would be a great overhead

Really there isn't a better solution?


Dan Labrecque wrote:
>
> Have you tried using a session scoped bean? Once you add the button to
> the JSF component tree, via your link action listener, it should be able
> to handle actions regardless if Ajax is used. However, if the bean is
> request scoped, the button will not be decoded because it was never
> found in the JSF component tree.
>
> Dan
>
> autozoom wrote:
>> hello,
>> I have this scenario:
>> my page contains a number of links, each of which is used to dynamically
>> add
>> components to the page, with a code snippet like this:
>>
>> Button button = new Button();
>> JSFActionManager.setValueExpression(button, "text", "#{Page1.txt}");
>> button.setStyle("left: 115px; top: 448px; position: absolute;");
>> form1.getChildren().add(button);
>>
>> I call this code from the links' action listener.
>>
>> Now I found out that these dynamically created components don't react to
>> Ajax functions like refresh() because, I think, the listener is called
>> after
>> the page's init().
>>
>> (if you try and add the code snippet to the init() method, the component
>> correctly reacts to a client side resfresh() call)
>>
>> Then, how can I achieve this result? The action listener is *always*
>> called
>> after init(), when it's already too late to add components to the page.
>> Does
>> this mean that I cannot use Ajax function on these dynamically added
>> components?
>>
>> Please let me know if my guess is right, I hope not.
>>
>> Thanks
>> Mauro
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_woodstock.dev.java.net
> For additional commands, e-mail: users-help_at_woodstock.dev.java.net
>
>
>

-- 
View this message in context: http://www.nabble.com/dynamically-adding-components-to-page-and-Ajax-issue-tp15267213p15273444.html
Sent from the Project Woodstock - Users mailing list archive at Nabble.com.