我想在延迟加载的页面上渲染一些检票口片段。Java 示例如下:
staticPanel.add(new AjaxLazyLoadPanel("fragment4Span") {
@Override
public Component getLazyLoadComponent(String id) {
fragment4 = new Fragment4(id, "fragment4", this);
fragment4.add(propertyLoop4);
return fragment4;
}
});
和 html 组件:
<span wicket:id="fragment4Span"></span>
<wicket:fragment wicket:id="fragment4">
</wicket:fragment>
但我得到以下例外:
org.apache.wicket.markup.MarkupException: Markup of component class `org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel` does not contain a fragment with wicket:id `fragment4`. Context: [MarkupContainer [Component id = content]]
at org.apache.wicket.markup.html.panel.Fragment.renderFragment(Fragment.java:262)
at org.apache.wicket.markup.html.panel.Fragment.onComponentTagBody(Fragment.java:212)
at org.apache.wicket.Component.renderComponent(Component.java:2680)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
这可能是什么原因?顺便说一句,我无法通过谷歌搜索找到答案。