On 3/15/08, Johan Compagner <[EMAIL PROTECTED]> wrote:
> You are not testing back button versioning a all.
>  What you do with the backbutton and a refresh is create a new page.
>  Because yiu are doing a bookmarkable (homepage) refresh.
>

I'm not hitting refresh, though.  It appears that IE is doing it
automatically for some reason.  Firefox isn't refreshing and the page
isn't behaving as expected (probably because it doesn't know that it
has changed).

>
>  Also if  you want backbutton support for your counter you have to
>  register that Change to the page.

By using modelChanged()?  Like this?

public class HomePage extends WebPage
{
    private static final long serialVersionUID = 1L;
    private static final Logger log = LoggerFactory.getLogger(HomePage.class);

    private int counter;

    public HomePage( final PageParameters parameters )
    {
        log.info("I'm (identity " + System.identityHashCode(this) + ")
being instantiated." );
        final Label label = new Label("message", new LoadableDetachableModel()
        {
            protected Object load()
            {
                return "I've been called " + counter + " times.";
            }
        });
        add(label);
        add(new Link("refreshLink")
        {
            public void onClick()
            {
                counter++;
                log.info("I'm being called on object with identity " +
System.identityHashCode(HomePage.this));
                HomePage.this.modelChanged();
            }
        });
        setStatelessHint(false);
    }

    public int getCounter()
    {
        return counter;
    }

    protected Object writeReplace() throws ObjectStreamException
    {
        final Object replacement = super.writeReplace();
        log.info("I'm (identity " + System.identityHashCode(this) + ")
being write replaced by object " + replacement);
        return replacement;
    }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to