Hi,

I'm stuck with some very basic concepts, even if i read a book about wicket.

Let's stress the counter-example, but first the questions:
- Basic questions: Why does the counter not increment on reload?
- Why is the WebPage created every time I reload the website, I though they are only created once? - Why isn't the Model used, so the Model keeps track where the value comes from? (ok, if the page is recreated every time, the model will be recreated, too. maybe solved with previous question).

The Code:

public class HomePage extends WebPage {

        private Long value = 0L;

        public HomePage(final PageParameters parameters) {
                Model m = new Model<Serializable>() {

                        private static final long serialVersionUID = 1L;
                        // It doesn't matters if I take this, or value
                        // from the WebPage
                        private Long val = 0L;

                        @Override
                        public Serializable getObject() {
                                return val++;
                        }

                };

                add(new Label("counter", m));
        }
}

<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"; >
    <body>
        Counter: <span wicket:id="counter">mycounter</span><br/>
    </body>
</html>


I didn't found an anwser by browsing the mailarchive or the web. Maybe the anwser is to obvious.

Regards
Daniel


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

Reply via email to