当我将 ChildPanel 添加到页面时,我收到一条错误消息:
org.apache.wicket.WicketRuntimeException:
The component(s) below failed to render.
A common problem is that you have added a component in code
but forgot to reference it in the markup
(thus the component will never be rendered).
1. [Form [Component id = myForm]]
2. [DropDownChoice [Component id = referenceType]]
3. [TextField [Component id = referenceNumber]]
4. [CheckBox [Component id = referenceReqChk]]
5. [ [Component id = saveRefNumButton]]
6. [ [Component id = cancelRefNumButton]]
at org.apache.wicket.Page.checkRendering(Page.java:693)
at org.apache.wicket.Page.onAfterRender(Page.java:849)
at org.apache.wicket.markup.html.WebPage.onAfterRender(WebPage.java:213)
at org.apache.wicket.Component.afterRender(Component.java:950)
at org.apache.wicket.Component.render(Component.java:2298)
at org.apache.wicket.Page.renderPage(Page.java:1041)
at org.apache.wicket.request.handler.render.
WebPageRenderer.renderPage(WebPageRenderer.java:105)
我可以清楚地看到有问题的组件被添加到我的 AbstractParentPanel 的标记中,我的 ChildPanel 扩展了它。奇怪的是,如果我将 AbstractParentPanel 设为非抽象类,我可以毫无问题地添加该面板。
为什么我会收到此错误?
注意:我已经找到了这个问题的答案。我将它添加到 SO 以帮助其他人,因为我浪费了比我应该花更多的时间来进行如此简单的检查。如果您被此消息所困扰并且此答案对您有所帮助,请考虑投票支持此 JIRA 票