Tentative de définir un modèle de l'objet à null modèle de composant

Je suis nouveau sur le Guichet, mais une recherche sur google ce problème n'avait pas de me donner quelque chose qui fait sens. J'espère donc que quelqu'un peut aider.

J'ai un SiteChoice objet qui s'étend au Formulaire, et un SiteList objet qui s'étend
DropDownChoice. Mon SiteChoice classe ressemble à:

  public class SiteChoice extends Form {
     public SiteChoice(String id) {
        super(id);

    addSiteDropDown();
     }

  private void addSiteDropDown() {

    ArrayList<DomainObj> siteList = new ArrayList<DomainObj>();
   //add objects to siteList

    ChoiceRenderer choiceRenderer = new ChoiceRenderer<DomainObj>("name", "URL");

    this.add(new SiteList("siteid",siteList,choiceRenderer));
   }
}

Ensuite, j'ai simplement ajouter mon SiteChoice objet de ma Page objet de la:

    SiteChoice form = new SiteChoice("testform");
    add(form);

Mon Guichet modèle a:

Lorsque je fais venir du haut de la page, il les rend beaux -- la liste déroulante est correctement rendu. Quand j'ai frappé Soumettre, je reçois cette erreur étrange:

WicketMessage: Method onFormSubmitted of interface 
  org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component   
 [MarkupContainer [Component id = fittest]] threw an exception

Root cause:

   java.lang.IllegalStateException: Attempt to set model object on null 
model of component: testform:siteid
    at org.apache.wicket.Component.setDefaultModelObject(Component.java:3033)
    at
  org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)
   at 
 [snip]

Je ne peux pas comprendre ce qui est null. Elle a rendu bien, il a trouvé les objets. Ce qui me manque?

OriginalL'auteur MikeHoss | 2010-08-10