Re: problem with page refresh
Hi Ale. I had a very similar problem, and I was able to get the behavior I expected by changing the render strategy to ONE_PASS_RENDER in Application.init(). Have a look at this http://apache-wicket.1842946.n4.nabble.com/refresh-and-AjaxFallbackDefaultDataTable-td4384935.html On Wed, Apr 18, 2012 at 7:12 AM, alezx wrote: > Hi guys, I ran into a problem lately, > > I have an instance variable in my panel and an ajax behaviour > > public final class ScrollLoader extends Panel implements IHeaderContributor > { > > int number = 0; > private AbstractDefaultAjaxBehavior b; > .. > > //constructor > public Scrolloader (...){ > b = new AbstractDefaultAjaxBehavior() { >@Override >protected void respond(AjaxRequestTarget target) { >System.out.println("number is "+number); >number++; >} > } > .. > } > } > > when I click a button on the page, with ajax I call this behaviour and the > number is incremented. > > if I click on the buttons 5 times, the number increments to 0,1,2,3,4, > then if I refresh the page and than click on the button other 5 times, the > number goes to 9 (5,6,7,8,9) > > //so far, so good! > > but now if I refresh the page again, and I click on the button the number > starts incrementing from 4 and not from 9!! (so If I press the button 5 > times I see again 5,6,7,8,9 and not 10,11,12..) > > > same problem when I load the page for the first time: > > If I *refresh * the page before incrementing the value, the number starts > incrementing from 0 > so i get 0,1,2,3,4 > if I refresh again, the number starts incrementing from 0 again.. > > in other words when I refresh the page 2, 3, 4 times, the number starts > incrementing from the value reached before the first refresh, after that > first refresh any change to the number is lost.. > > so what do I do wrong? > > sorry if this is a bit confusing, > > and thanks for your help! > > ale > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/problem-with-page-refresh-tp4567392p4567392.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: problem with page refresh
Hi, I see you use 1.4.x (implementing IHeaderContributor). Which url coding strategy is used for this page ? I'd recommend you to use HybridUrlCodingStrategy because it keeps the page id in the url (something like: my/page.4) This is the reason why urls for stateful pages in Wicket 1.5 also keep the pageId in the url (my/page?4). This way even the refresh keeps the last state of the page. Without the page id Wicket would create a new instance of the page. On Wed, Apr 18, 2012 at 2:12 PM, alezx wrote: > Hi guys, I ran into a problem lately, > > I have an instance variable in my panel and an ajax behaviour > > public final class ScrollLoader extends Panel implements IHeaderContributor > { > > int number = 0; > private AbstractDefaultAjaxBehavior b; > .. > > //constructor > public Scrolloader (...){ > b = new AbstractDefaultAjaxBehavior() { > @Override > protected void respond(AjaxRequestTarget target) { > System.out.println("number is "+number); > number++; > } > } > .. > } > } > > when I click a button on the page, with ajax I call this behaviour and the > number is incremented. > > if I click on the buttons 5 times, the number increments to 0,1,2,3,4, > then if I refresh the page and than click on the button other 5 times, the > number goes to 9 (5,6,7,8,9) > > //so far, so good! > > but now if I refresh the page again, and I click on the button the number > starts incrementing from 4 and not from 9!! (so If I press the button 5 > times I see again 5,6,7,8,9 and not 10,11,12..) > > > same problem when I load the page for the first time: > > If I *refresh * the page before incrementing the value, the number starts > incrementing from 0 > so i get 0,1,2,3,4 > if I refresh again, the number starts incrementing from 0 again.. > > in other words when I refresh the page 2, 3, 4 times, the number starts > incrementing from the value reached before the first refresh, after that > first refresh any change to the number is lost.. > > so what do I do wrong? > > sorry if this is a bit confusing, > > and thanks for your help! > > ale > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/problem-with-page-refresh-tp4567392p4567392.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
problem with page refresh
Hi guys, I ran into a problem lately, I have an instance variable in my panel and an ajax behaviour public final class ScrollLoader extends Panel implements IHeaderContributor { int number = 0; private AbstractDefaultAjaxBehavior b; .. //constructor public Scrolloader (...){ b = new AbstractDefaultAjaxBehavior() { @Override protected void respond(AjaxRequestTarget target) { System.out.println("number is "+number); number++; } } .. } } when I click a button on the page, with ajax I call this behaviour and the number is incremented. if I click on the buttons 5 times, the number increments to 0,1,2,3,4, then if I refresh the page and than click on the button other 5 times, the number goes to 9 (5,6,7,8,9) //so far, so good! but now if I refresh the page again, and I click on the button the number starts incrementing from 4 and not from 9!! (so If I press the button 5 times I see again 5,6,7,8,9 and not 10,11,12..) same problem when I load the page for the first time: If I *refresh * the page before incrementing the value, the number starts incrementing from 0 so i get 0,1,2,3,4 if I refresh again, the number starts incrementing from 0 again.. in other words when I refresh the page 2, 3, 4 times, the number starts incrementing from the value reached before the first refresh, after that first refresh any change to the number is lost.. so what do I do wrong? sorry if this is a bit confusing, and thanks for your help! ale -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/problem-with-page-refresh-tp4567392p4567392.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org