wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ernesto Reinaldo Barreiro <reier...@gmail.com>
Subject Re: AbstractAjaxTimerBehavior causes exception
Date Wed, 11 Nov 2009 08:35:10 GMT
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.Giambalvo@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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message