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.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$PoolThread.run(QueuedThreadPool.java
> :582)
>
>
>
> Greets
>
> Chris
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to