AW: AbstractAjaxTimerBehavior causes exception
Works great with a Container. Thanks Ernesto, you're the best :) Saludo Chris -Ursprüngliche Nachricht- Von: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] Gesendet: Mittwoch, 11. November 2009 10:28 An: users@wicket.apache.org Betreff: Re: AbstractAjaxTimerBehavior causes exception Put a container (WebMarkupContainer?) around components you want to update, atatch the behavior to that container and make sure the comapoent you want to update are "dynamic": meaning that theirs "state" should change every time they are rendered. Best, Ernesto On Wed, Nov 11, 2009 at 10:24 AM, Giambalvo, Christian < christian.giamba...@excelsisnet.com> wrote: > You're right Ernesto, your example works, but what if I want to replace a > whole panel and not just the model of a label? > > > -Ursprüngliche Nachricht- > Von: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] > Gesendet: Mittwoch, 11. November 2009 10:15 > An: users@wicket.apache.org > Betreff: Re: AbstractAjaxTimerBehavior causes exception > > Well I think it all boils down to the explanation a gave on my first > e-mail: > if you replace the component with a new one that does not have the behavior > then you will get an exception (the same will happend if you remove the > behavior during a round trip). I guess Martin was just trying to say that > you should use the same label...? Did you try the code I posted? It does > work ;-) > > Cheers, > > Ernesto > > On Wed, Nov 11, 2009 at 10:06 AM, Giambalvo, Christian < > christian.giamba...@excelsisnet.com> wrote: > > > Hi Martin, > > > > this doesn't work. > > > >@Override > >protected void onTimer(AjaxRequestTarget target) > >{ > >Label t2 = new Label("message", "Test " + testCounter); > > t2.setOutputMarkupId(true); > > test = t2; > >testCounter++; > >target.addComponent(test); > >} > > It doesn't throw an exception, but the t2 didn't show up. > > I think this is because t2 isn't added to the page. > > That's why there is Component#replaceWith(Component). > > > > Greets > > > > -Ursprüngliche Nachricht- > > Von: Martin Grigorov [mailto:mcgreg...@e-card.bg] > > Gesendet: Mittwoch, 11. November 2009 09:59 > > An: users@wicket.apache.org > > Betreff: Re: AbstractAjaxTimerBehavior causes exception > > > > On Wed, 2009-11-11 at 09:21 +0100, Giambalvo, Christian wrote: > > > Hi all, > > > > > > > > > > > > maybe i found a bug. > > > > > > Don't know if I'm doing something wrong. > > > > > > But it's a simple usecase. > > > > > > > > > > > > Following code produces an exception: > > > > > > > > > > > > public class HomePage extends WebPage { > > > > > > > > > > > > private static final long serialVersionUID = 1L; > > > > > > > > > > > > private static int testCounter = 0; > > > > > > > > > > > > public HomePage(final PageParameters parameters) { > > > > > > > > > > > > // Add the simplest type of label > > > > > > final Label test = new Label("message", "If you see this > message > > > wicket is properly configured and running"); > > > > > > test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1)) > > > > > > { > > > > > > @Override > > > > > > protected void onTimer(AjaxRequestTarget target) > > > > > > { > > > > > > Label t2 = new Label("message", "Test " + testCounter); > > > > > > test.replaceWith(t2); > > here you need to make : test = t2; > > > > > > testCounter++; > > > > > > target.addComponent(test); > > > > > > } > > > > > > }); > > > > > > > > > > > > add(test); > > > > > > } > > > > > > } > > > > > > > > > > > > Exception: > > > > > > Root cause: > > > > > > java.lang.IllegalStateException: No Page found for component [Component > > > id = message] > > > at org.apache.wicket.Component.getPage(Component.java:1754) > > > at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872) > > > at org.apache.wicket.Component.urlFor(Component.java:3286) > > > at > > > > org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA > > > jaxBehavior.java:124) > > > at > > > > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr > > > actAjaxTimerBehavior.java:127) > > > at > > > > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra > > > ctAjaxTimerBehavior.java:120) > > > at > > > > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim > > > erBehavior.java:163) > > > at > > > > org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef > > > aultAjaxBehavior.java:299) > > > at > > > > org.apache.wicket.request.target.component.listener.BehaviorRequestTarge > > > t.processEvents(BehaviorRequestTarget.java:119) > > > at > > > > org.apache.wicket.requ
Re: AW: AbstractAjaxTimerBehavior causes exception
I didn't mean to 'replace' but to 'add'. You need both lines. On Wed, 2009-11-11 at 10:06 +0100, Giambalvo, Christian wrote: > Hi Martin, > > this doesn't work. > > @Override > protected void onTimer(AjaxRequestTarget target) > { > Label t2 = new Label("message", "Test " + testCounter); > t2.setOutputMarkupId(true); > test = t2; > testCounter++; > target.addComponent(test); > } > It doesn't throw an exception, but the t2 didn't show up. > I think this is because t2 isn't added to the page. > That’s why there is Component#replaceWith(Component). > > Greets > > -Ursprüngliche Nachricht- > Von: Martin Grigorov [mailto:mcgreg...@e-card.bg] > Gesendet: Mittwoch, 11. November 2009 09:59 > An: users@wicket.apache.org > Betreff: Re: AbstractAjaxTimerBehavior causes exception > > On Wed, 2009-11-11 at 09:21 +0100, Giambalvo, Christian wrote: > > Hi all, > > > > > > > > maybe i found a bug. > > > > Don't know if I'm doing something wrong. > > > > But it's a simple usecase. > > > > > > > > Following code produces an exception: > > > > > > > > public class HomePage extends WebPage { > > > > > > > > private static final long serialVersionUID = 1L; > > > > > > > > private static int testCounter = 0; > > > > > > > > public HomePage(final PageParameters parameters) { > > > > > > > > // Add the simplest type of label > > > > final Label test = new Label("message", "If you see this message > > wicket is properly configured and running"); > > > > test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1)) > > > > { > > > > @Override > > > > protected void onTimer(AjaxRequestTarget target) > > > > { > > > > Label t2 = new Label("message", "Test " + testCounter); > > > > test.replaceWith(t2); > here you need to make : test = t2; > > > > testCounter++; > > > > target.addComponent(test); > > > > } > > > > }); > > > > > > > > add(test); > > > > } > > > > } > > > > > > > > Exception: > > > > Root cause: > > > > java.lang.IllegalStateException: No Page found for component [Component > > id = message] > > at org.apache.wicket.Component.getPage(Component.java:1754) > > at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872) > > at org.apache.wicket.Component.urlFor(Component.java:3286) > > at > > org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA > > jaxBehavior.java:124) > > at > > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr > > actAjaxTimerBehavior.java:127) > > at > > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra > > ctAjaxTimerBehavior.java:120) > > at > > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim > > erBehavior.java:163) > > at > > org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef > > aultAjaxBehavior.java:299) > > at > > org.apache.wicket.request.target.component.listener.BehaviorRequestTarge > > t.processEvents(BehaviorRequestTarget.java:119) > > at > > org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab > > stractRequestCycleProcessor.java:92) > > at > > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java > > :1250) > > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329) > > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428) > > at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) > > at > > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468 > > ) > > at > > org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java: > > 301) > > at > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan > > dler.java:1157) > > at > > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) > > at > > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:2 > > 16) > > at > > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) > > at > > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) > > at > > org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) > > at > > org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandler > > Collection.java:230) > > at > > org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.jav > > a:114) > > at > > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) > > at org.mortbay.jetty.Server.handle(Server.java:326) > > at > > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536) > > at > > org
AW: AbstractAjaxTimerBehavior causes exception
You're right Ernesto, your example works, but what if I want to replace a whole panel and not just the model of a label? -Ursprüngliche Nachricht- Von: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] Gesendet: Mittwoch, 11. November 2009 10:15 An: users@wicket.apache.org Betreff: Re: AbstractAjaxTimerBehavior causes exception Well I think it all boils down to the explanation a gave on my first e-mail: if you replace the component with a new one that does not have the behavior then you will get an exception (the same will happend if you remove the behavior during a round trip). I guess Martin was just trying to say that you should use the same label...? Did you try the code I posted? It does work ;-) Cheers, Ernesto On Wed, Nov 11, 2009 at 10:06 AM, Giambalvo, Christian < christian.giamba...@excelsisnet.com> wrote: > Hi Martin, > > this doesn't work. > >@Override >protected void onTimer(AjaxRequestTarget target) >{ >Label t2 = new Label("message", "Test " + testCounter); > t2.setOutputMarkupId(true); > test = t2; >testCounter++; >target.addComponent(test); >} > It doesn't throw an exception, but the t2 didn't show up. > I think this is because t2 isn't added to the page. > That's why there is Component#replaceWith(Component). > > Greets > > -Ursprüngliche Nachricht- > Von: Martin Grigorov [mailto:mcgreg...@e-card.bg] > Gesendet: Mittwoch, 11. November 2009 09:59 > An: users@wicket.apache.org > Betreff: Re: AbstractAjaxTimerBehavior causes exception > > On Wed, 2009-11-11 at 09:21 +0100, Giambalvo, Christian wrote: > > Hi all, > > > > > > > > maybe i found a bug. > > > > Don't know if I'm doing something wrong. > > > > But it's a simple usecase. > > > > > > > > Following code produces an exception: > > > > > > > > public class HomePage extends WebPage { > > > > > > > > private static final long serialVersionUID = 1L; > > > > > > > > private static int testCounter = 0; > > > > > > > > public HomePage(final PageParameters parameters) { > > > > > > > > // Add the simplest type of label > > > > final Label test = new Label("message", "If you see this message > > wicket is properly configured and running"); > > > > test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1)) > > > > { > > > > @Override > > > > protected void onTimer(AjaxRequestTarget target) > > > > { > > > > Label t2 = new Label("message", "Test " + testCounter); > > > > test.replaceWith(t2); > here you need to make : test = t2; > > > > testCounter++; > > > > target.addComponent(test); > > > > } > > > > }); > > > > > > > > add(test); > > > > } > > > > } > > > > > > > > Exception: > > > > Root cause: > > > > java.lang.IllegalStateException: No Page found for component [Component > > id = message] > > at org.apache.wicket.Component.getPage(Component.java:1754) > > at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872) > > at org.apache.wicket.Component.urlFor(Component.java:3286) > > at > > org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA > > jaxBehavior.java:124) > > at > > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr > > actAjaxTimerBehavior.java:127) > > at > > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra > > ctAjaxTimerBehavior.java:120) > > at > > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim > > erBehavior.java:163) > > at > > org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef > > aultAjaxBehavior.java:299) > > at > > org.apache.wicket.request.target.component.listener.BehaviorRequestTarge > > t.processEvents(BehaviorRequestTarget.java:119) > > at > > org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab > > stractRequestCycleProcessor.java:92) > > at > > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java > > :1250) > > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329) > > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428) > > at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) > > at > > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468 > > ) > > at > > org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java: > > 301) > > at > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan > > dler.java:1157) > > at > > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) > > at > > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:2 > > 16) > > at > > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.
AW: AbstractAjaxTimerBehavior causes exception
Hi Martin, this doesn't work. @Override protected void onTimer(AjaxRequestTarget target) { Label t2 = new Label("message", "Test " + testCounter); t2.setOutputMarkupId(true); test = t2; testCounter++; target.addComponent(test); } It doesn't throw an exception, but the t2 didn't show up. I think this is because t2 isn't added to the page. That’s why there is Component#replaceWith(Component). Greets -Ursprüngliche Nachricht- Von: Martin Grigorov [mailto:mcgreg...@e-card.bg] Gesendet: Mittwoch, 11. November 2009 09:59 An: users@wicket.apache.org Betreff: Re: AbstractAjaxTimerBehavior causes exception On Wed, 2009-11-11 at 09:21 +0100, Giambalvo, Christian wrote: > Hi all, > > > > maybe i found a bug. > > Don't know if I'm doing something wrong. > > But it's a simple usecase. > > > > Following code produces an exception: > > > > public class HomePage extends WebPage { > > > > private static final long serialVersionUID = 1L; > > > > private static int testCounter = 0; > > > > public HomePage(final PageParameters parameters) { > > > > // Add the simplest type of label > > final Label test = new Label("message", "If you see this message > wicket is properly configured and running"); > > test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1)) > > { > > @Override > > protected void onTimer(AjaxRequestTarget target) > > { > > Label t2 = new Label("message", "Test " + testCounter); > > test.replaceWith(t2); here you need to make : test = t2; > > testCounter++; > > target.addComponent(test); > > } > > }); > > > > add(test); > > } > > } > > > > Exception: > > Root cause: > > java.lang.IllegalStateException: No Page found for component [Component > id = message] > at org.apache.wicket.Component.getPage(Component.java:1754) > at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872) > at org.apache.wicket.Component.urlFor(Component.java:3286) > at > org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA > jaxBehavior.java:124) > at > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr > actAjaxTimerBehavior.java:127) > at > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra > ctAjaxTimerBehavior.java:120) > at > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim > erBehavior.java:163) > at > org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef > aultAjaxBehavior.java:299) > at > org.apache.wicket.request.target.component.listener.BehaviorRequestTarge > t.processEvents(BehaviorRequestTarget.java:119) > at > org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab > stractRequestCycleProcessor.java:92) > at > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java > :1250) > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329) > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428) > at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) > at > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468 > ) > at > org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java: > 301) > at > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan > dler.java:1157) > at > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) > at > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:2 > 16) > at > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) > at > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) > at > org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) > at > org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandler > Collection.java:230) > at > org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.jav > a:114) > at > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) > at org.mortbay.jetty.Server.handle(Server.java:326) > at > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536) > at > org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConne > ction.java:915) > at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539) > at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) > at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405) > at > org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java: > 409) > at > org.mortbay.thread.QueuedThreadPool$PoolThr
AW: AbstractAjaxTimerBehavior causes exception
Btw, the exception is thrown on first call not on second round trip. -Ursprüngliche Nachricht- Von: Giambalvo, Christian [mailto:christian.giamba...@excelsisnet.com] Gesendet: Mittwoch, 11. November 2009 09:39 An: users@wicket.apache.org Betreff: AW: AbstractAjaxTimerBehavior causes exception Hi Ernesto, the label was just an example. In my app i try to replace the navigation (you remember your suggestion with a timer?) The navigation is a panel. So recreate the whole panel and then try to replace it with the new one. This is where the AbstractAjaxTimerBehavior comes in. Greets Chris -Ursprüngliche Nachricht- Von: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] Gesendet: Mittwoch, 11. November 2009 09:35 An: users@wicket.apache.org Betreff: Re: AbstractAjaxTimerBehavior causes exception Hi Chris, Maybe it is because you are adding the timer to the label and later on replacing it is another component. Then the second AJAX round trip to the page will look for the AbstractAjaxTimerBehavior associated to the "message" component, but the new one does not have associated such a behavior. And you do not need to replace the label component (just udpate it via AJAX): just write a model that displays "If you see this message wicket is properly configured and running" if count =0 and "Test " + testCounter if >0. Best, Ernesto On Wed, Nov 11, 2009 at 9:21 AM, Giambalvo, Christian < christian.giamba...@excelsisnet.com> wrote: > Hi all, > > > > maybe i found a bug. > > Don't know if I'm doing something wrong. > > But it's a simple usecase. > > > > Following code produces an exception: > > > > public class HomePage extends WebPage { > > > >private static final long serialVersionUID = 1L; > > > >private static int testCounter = 0; > > > >public HomePage(final PageParameters parameters) { > > > >// Add the simplest type of label > >final Label test = new Label("message", "If you see this message > wicket is properly configured and running"); > >test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1)) > >{ > >@Override > >protected void onTimer(AjaxRequestTarget target) > >{ > >Label t2 = new Label("message", "Test " + testCounter); > >test.replaceWith(t2); > >testCounter++; > >target.addComponent(test); > >} > >}); > > > >add(test); > >} > > } > > > > Exception: > > Root cause: > > java.lang.IllegalStateException: No Page found for component [Component > id = message] > at org.apache.wicket.Component.getPage(Component.java:1754) > at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872) > at org.apache.wicket.Component.urlFor(Component.java:3286) > at > org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA > jaxBehavior.java:124) > at > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr > actAjaxTimerBehavior.java:127) > at > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra > ctAjaxTimerBehavior.java:120) > at > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim > erBehavior.java:163) > at > org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef > aultAjaxBehavior.java:299) > at > org.apache.wicket.request.target.component.listener.BehaviorRequestTarge > t.processEvents(BehaviorRequestTarget.java:119) > at > org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab > stractRequestCycleProcessor.java:92) > at > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java > :1250) > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329) > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428) > at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) > at > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468 > ) > at > org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java: > 301) > at > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan > dler.java:1157) > at > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) > at > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:2 > 16) > at > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) > at > org.mortbay.jetty.handler.ContextHandler.
AW: AbstractAjaxTimerBehavior causes exception
Hi Ernesto, the label was just an example. In my app i try to replace the navigation (you remember your suggestion with a timer?) The navigation is a panel. So recreate the whole panel and then try to replace it with the new one. This is where the AbstractAjaxTimerBehavior comes in. Greets Chris -Ursprüngliche Nachricht- Von: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] Gesendet: Mittwoch, 11. November 2009 09:35 An: users@wicket.apache.org Betreff: Re: AbstractAjaxTimerBehavior causes exception Hi Chris, Maybe it is because you are adding the timer to the label and later on replacing it is another component. Then the second AJAX round trip to the page will look for the AbstractAjaxTimerBehavior associated to the "message" component, but the new one does not have associated such a behavior. And you do not need to replace the label component (just udpate it via AJAX): just write a model that displays "If you see this message wicket is properly configured and running" if count =0 and "Test " + testCounter if >0. Best, Ernesto On Wed, Nov 11, 2009 at 9:21 AM, Giambalvo, Christian < christian.giamba...@excelsisnet.com> wrote: > Hi all, > > > > maybe i found a bug. > > Don't know if I'm doing something wrong. > > But it's a simple usecase. > > > > Following code produces an exception: > > > > public class HomePage extends WebPage { > > > >private static final long serialVersionUID = 1L; > > > >private static int testCounter = 0; > > > >public HomePage(final PageParameters parameters) { > > > >// Add the simplest type of label > >final Label test = new Label("message", "If you see this message > wicket is properly configured and running"); > >test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1)) > >{ > >@Override > >protected void onTimer(AjaxRequestTarget target) > >{ > >Label t2 = new Label("message", "Test " + testCounter); > >test.replaceWith(t2); > >testCounter++; > >target.addComponent(test); > >} > >}); > > > >add(test); > >} > > } > > > > Exception: > > Root cause: > > java.lang.IllegalStateException: No Page found for component [Component > id = message] > at org.apache.wicket.Component.getPage(Component.java:1754) > at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872) > at org.apache.wicket.Component.urlFor(Component.java:3286) > at > org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA > jaxBehavior.java:124) > at > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr > actAjaxTimerBehavior.java:127) > at > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra > ctAjaxTimerBehavior.java:120) > at > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim > erBehavior.java:163) > at > org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef > aultAjaxBehavior.java:299) > at > org.apache.wicket.request.target.component.listener.BehaviorRequestTarge > t.processEvents(BehaviorRequestTarget.java:119) > at > org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab > stractRequestCycleProcessor.java:92) > at > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java > :1250) > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329) > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428) > at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) > at > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468 > ) > at > org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java: > 301) > at > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan > dler.java:1157) > at > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) > at > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:2 > 16) > at > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) > at > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) > at > org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) > at > org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandler > Collection.java:230) > at > org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.jav > a:114) > at > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) > at org.mortbay.jetty.Server.handle(Server.java:326) > at > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536) > at > org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConne > ction.java:915) > at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539) > at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:2