Wicket을 처음 사용했지만이 문제를 검색해도 의미가 없었습니다. 그래서 나는 SO의 누군가가 도울 수 있기를 바라고있다.구성 요소의 null 모델에서 모델 객체를 설정하려고 시도했습니다.
Form을 확장하는 SiteChoice 개체와 DropDownChoice를 확장하는 SiteList 개체가 있습니다.
SiteChoice form = new SiteChoice("testform");
add(form);
내 개찰구 템플릿이 있습니다 :
이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));
}
}
그럼 난 단지 라 내 Page 개체에 내 SiteChoice 개체를 추가 : 내 SiteChoice 클래스처럼 보이는
I 페이지를 표시하면 렌더링이 잘되며 드롭 다운 목록이 올바르게 렌더링됩니다. Submit을 누르면, 이상한 오류가 발생합니다 :
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]
null이 무엇인지 알 수 없습니다. 그것은 잘 렌더링되었으므로 객체를 찾았습니다. 내가 뭘 놓치고 있니?
감사 tpdi을. 그게 효과가 있었어. – MikeHoss