This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Referencing Models From Inner Classes
Skip to end of metadata
Go to start of metadata

This information may be a bit of an edge case, but this documentation may help others that have an application similar to mine. Specifically, I was having issues with an ajax request did not recreate component with changed model.

My problem was that I created a label with constant model, that is set to the value of currentItem.getName. So even if you change current item later, the item container is not recreated, thus the label still shows old current item name.

The solution would be to create the label like this (assuming currentItem is a member variable of enclosing class):

public class MyPage extends WebPage {
  private MyObject object;

  public MyObject getObject() {
    return object;
  }

  public void setObject(MyObject object) {
    this.object = object;
  }

  public class MyObjectDetailsContainer extends WebMarkupContainer {
    public MyObjectDetailsContainer(String id) {
      add(new Label("objectName", new PropertyModel(MyPage.this, "object.name"));
    }
  }
}
  • No labels