modelChanged()? Sent from tablet device. Please excuse typos and brevity. On Dec 8, 2011 12:58 AM, "Dan Retzlaff" <[email protected]> wrote:
> Hi, Robin. I am not a core developer, but I believe this is as designed. If > you want the page version to be incremented, you can call Page#dirty() in > your onClick(). Otherwise the page version only advances when the component > hierarchy changes or when a component's model changes. > > On Wed, Dec 7, 2011 at 8:24 PM, Robin Shine <[email protected]> wrote: > > > Hi All, > > > > > > In Wicket 1.5.3, I create a very simple page containing a label and a > > link, when the link is clicked, it increases a counter, and change model > > value of the label. Thus the counter on the page will increase each time > > the link is clicked. For instance, the initial value displayed is 0, and > > after three clicks, the page displays value 3. However, the url remains > > unchanged while clicking the link, and hitting a back button at this time > > will display the page before displaying value 0, instead of displaying > > value 2. > > > > > > Is this a designed behavior or a bug? The page java code and its template > > is like below: > > > > > > TestPage.java: > > > > public class MyPage extends WebPage { > > > > private int count; > > protected void onInitialize() { > > super.onInitialize(); > > add(new Link<Void>("link") { > > public void onClick() { > > count++; > > } > > }); > > add(new Label("label", new AbstractReadOnlyModel<String>() { > > public String getObject() { > > return String.valueOf(count); > > } > > })); > > } > > } > > > > TestPage.html: > > > > <a wicket:id="link">link</a> > > <span wicket:id="label">label</span> > > > > > > Thanks for your help. > > > > Robin > > >
