title: Wicket: PropertyModel updates
body: <p>Ive got following code to Update a User.class:</p>
  
  <pre><code> @SuppressWarnings("serial")
   public class UpdateProfilePanel extends Panel{
  
  protected ServiceClientTemp client = ((WicketApplication) (WicketApplication.get())).getClient();
  protected User oldUser;
  protected User newUser;
  
  public UpdateProfilePanel(String id) {
      super(id);  
      Form updateProfileForm = new UpdateProfileForm("updateProfileForm");
      add(updateProfileForm);
  }
  
  
  class UpdateProfileForm extends Form {
  
      private FormComponent formForename;
      private FormComponent formSurname;
      private FormComponent formEmail;
  
      public UpdateProfileForm(String id) {
          super(id);
          oldUser = client.getSessionUser();
          formForename = new TextField("forename1", new PropertyModel(oldUser, "forename"));
          formSurname = new TextField("surname1", new PropertyModel(oldUser, "surname"));
          formEmail = new TextField("email1", new PropertyModel(oldUser, "email"));
          add(formForename);
          add(formSurname);
          add(formEmail);
      }
  
      public void onSubmit() {
          newUser = new User();
          newUser.setForename(formForename.getInput());
          newUser.setSurname(formSurname.getInput());
          newUser.setEmail(formEmail.getInput());
      }
  }
  
  
  
    }
  </code></pre>
  
  <p>When I enter a new forename and press my submit button, the new value stays in the Textfield. For later works thats fine like this, but just for understanding: Why does he update my Textfield, when the PropertyModel refrences still to oldUser and by client.getSessionUser() I get still the oldUser. There was no update in the backend.</p>
  
  <p>On the same WebPage Ive got another Panel, which gives me the actuall user information.</p>
  
  <pre><code> @SuppressWarnings("serial")
  public class UserInfoPanel extends Panel {
  
  protected ServiceClientTemp client = ((WicketApplication) (WicketApplication.get())).getClient();
  protected User infoUser;
  
  
  @SuppressWarnings("rawtypes")
  UserInfoPanel(String id) {
      super(id);
  
  
      infoUser = client.getSessionUser();
      add(new Label("username", new PropertyModel(infoUser, "username")));
      add(new Label("surname", new PropertyModel(infoUser, "surname")));
      add(new Label("forename", new PropertyModel(infoUser, "forename")));
      add(new Label("email", new PropertyModel(infoUser, "email")));
      add(new Label("state", new PropertyModel(infoUser, "state")));
  
  }
  
    }
  </code></pre>
  
  <p>Also this labels turn into the new value, although he gets still the oldUser by client.getSessionUser(), because the update method is not implemented yet.</p>
  
  <p>Hopefully someone can explain me why the PropertyModels reference to the newUser instead of the oldUser. Why else is it like I construct my PropertyModel like PropertyMode(oldUser, ...</p>