you cannot add a new component via an ajax call because wicket will not know where to put its markup. via ajax you can only replace components that have been previously renderered.

so in your case if you wanted to replace the Label you would do something like this

final Label label;

add(label=new Label("a", "A"));

label.setOutputMarkupId (true); <=== this is important if you want to rerender this component via ajax

 add(new AjaxLink("link") {
     public void onClick(AjaxRequestTarget ajaxRequestTarget) {
        Label b = new Label("a","B");

        label.getparent().replace(b);

        ajaxRequestTarget.addComponent (label);
     }
 });


-Igor



On 3/15/06, Ayodeji Aladejebi <[EMAIL PROTECTED]> wrote:


Please someone should tell me why i can deploy the Ajax examples in Wicket-examples and it runs fine in tomcat and when i repeat the same approach in my own application, the browser gives me error?

I have been fighting with these _javascript_ problem for some time but no much progress
 
please please guys what can be wrong....isnt it as basic as

add(new Label("a", "A"));

 add(new AjaxLink("link") {
     public void onClick(AjaxRequestTarget ajaxRequestTarget) {
        Label b = new Label("a","B");
        ajaxRequestTarget.addComponent (b);
     }
 });

is there some configuration i am not putting in place?


Reply via email to