Eelco Hillenius wrote:
> 
> Could you please provide us with a little bit of code to look at your
> case?
> 

Here is the most trivial case I could come up with.  Click the number 1. 
Click your browser's back button.  Click the number 2.  I would expect the
page to say "1 200", but it says, "100 200".

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd";>
<html lang="en">
<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8">

<title>Test Page</title>

</head>

<body>

<p>
# <span wicket:id="a">text here</span> 
</p>

<p>
# <span wicket:id="b">text also here</span> 
</p>
</body>

</html>

import wicket.markup.html.WebPage;
import wicket.markup.html.link.Link;
import wicket.markup.html.basic.Label;
import wicket.model.CompoundPropertyModel;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

class StatePojo implements java.io.Serializable {
    private int a;
    private int b;

    public StatePojo() { a = 1; b = 2; }

    public int getA() { return a; }
    public void setA(int a) { this.a = a; }

    public int getB() { return b; }
    public void setB(int b) { this.b = b; }
}

public class TestPage extends WebPage {
    private static Log log = LogFactory.getLog(PpiPage.class);

    public TestPage() {
        super(new CompoundPropertyModel(new StatePojo()));

        Link aLink = new Link("aLink") {
                public void onClick() {
                    getParent().modelChanging();
                    ((StatePojo) getParent().getModelObject()).setA(100);
                    getParent().modelChanged();
                }
            };
     
        aLink.add(new Label("a"));
        
        add(aLink);
 
        Link bLink = new Link("bLink") {
                public void onClick() {
                    getParent().modelChanging();
                    ((StatePojo) getParent().getModelObject()).setB(200);
                    getParent().modelChanged();
                }
            };
        
        bLink.add(new Label("b"));

        add(bLink);
    }
}    

-- 
View this message in context: 
http://www.nabble.com/Versioning-a-PropertyModel-backed-by-another-Model-tf2166294.html#a6026125
Sent from the Wicket - User forum at Nabble.com.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to