On Tue, Jul 10, 2012 at 1:50 PM, Anna Hunecke <[email protected]> wrote: > Hi, > > @Thomas: yeah, this is useful when opening the page from a link, but there I > don't have a problem. > > @Martin, this works perfectly, thank you :) > Just wondering: wouldn't it be better to override renderPage()? > Because then you can just set the responsePage there and return immediately. > > @Override > public void renderPage() { > if (hasBeenRendered()) { > setResponsePage(getPageClass(), getPageParameters()); > } > else { > super.renderPage(); > } > }
If this works for you then use it. > > This is not possible in the onBeforeRender() method, because wicket forces me > to call super.onBeforeRender(). > Which is probably not what I want, because then first the old page gets > rendered and only after that it builds a new page (at least it seems to be > that this is happening). > Any insights? > > Best, > Anna > > -----Original Message----- > From: Martin Grigorov [mailto:[email protected]] > Sent: Dienstag, 10. Juli 2012 12:08 > To: [email protected] > Subject: Re: How to force a page to re-render > > I think this is what she needs: > > MyPage.java: > > @Override > public void onBeforeRender() { > if (hasBeenRendered()) { > setResponsePage(getPageClass(), getPageParameters()); > } > } > > On Tue, Jul 10, 2012 at 12:52 PM, Thomas Götz <[email protected]> wrote: >> What about this? >> >> Link link = new Link("link") { >> @Override >> public void onClick() { >> setResponsePage(new MyPage()); >> } >> }; >> >> -Tom >> >> >> >> On 10.07.2012, at 11:36, Anna Hunecke wrote: >> >>> Hi, >>> >>> I'm trying to force a page to re-render everytime the user clicks the >>> refresh button. Wicket sees the page as a stateful page, but I'm not >>> interested at all in keeping this state. >>> >>> What I would like to do is to get the newest data from the database on >>> refresh and display it. I tried to use LoadableDetachableModels for this, >>> but ran into trouble pretty soon. The main reason is that the data also >>> determines visibility and styling of individual elements in the page which >>> makes the code very complicated with lots of LoadableDetachableModels and >>> Behaviors (The page is not exactly small). Also, the page size increases, >>> and I want to avoid that. >>> >>> So, I ended up in overwriting the renderPage() method in my page, throwing >>> away all content and drawing it again. But I don't like this solution. Can >>> I somehow force wicket to throw away the complete page and create a new one? >>> >>> Regards, >>> Anna >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > > > -- > Martin Grigorov > jWeekend > Training, Consulting, Development > http://jWeekend.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
