Wicket:打开 ModalWindow(弹出窗口)时崩溃
在 Wicket 面板中,我实现了一个名为 showAttentiePopup(AjaxRequestTarget) 的方法,该方法显示 ModalWindow 弹出屏幕。当我从同一个面板调用该方法时,该方法工作正常。但是,当我尝试从另一个面板调用该方法时,它崩溃并出现以下错误:
java.lang.IllegalStateException: No Page found for component [MarkupContainer [Component id = createAttentie]]
at org.apache.wicket.Component.getPage(Component.java:1665)
at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:851)
at org.apache.wicket.Component.urlFor(Component.java:3170)
at org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractAjaxBehavior.java:123)
at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.getCallbackScript(AbstractDefaultAjaxBehavior.java:116)
at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.getCallbackScript(AbstractDefaultAjaxBehavior.java:104)
at org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow$CloseButtonBehavior.getCallbackScript(ModalWindow.java:876)
at org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow.getWindowOpenJavascript(ModalWindow.java:1005)
at org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow.show(ModalWindow.java:286)
at nl.topicuszorg.fks.web.client.dossier.overzichten.documenten.AttentieOverzichtPanel.showAttentiePopup(AttentieOverzichtPanel.java:171)
at nl.topicuszorg.fks.web.client.dossier.overzichten.documenten.EditFileDocumentPanel$2.onSubmit(EditFileDocumentPanel.java:195)
at org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink$1.onSubmit(AjaxSubmitLink.java:94)
at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:128)
at org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:163)
at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:297)
有人知道问题可能是什么吗?
showAttentiePopup 方法:
public void showAttentiePopup(AjaxRequestTarget target) {
Component content = new EditAttentiePanel(createAttentie.getContentId(), new Attentie(), EditFunctie.AANMAKEN) {
/** */
private static final long serialVersionUID = 1L;
@Override
protected void annuleren(AjaxRequestTarget target) {
FKSModalWindow.closeCurrentWindow(target);
}
@Override
protected void opslaan(AjaxRequestTarget target, Attentie attentie) {
//Inhoud even weggelaten
}
};
createAttentie.setOutputMarkupId(true);
createAttentie.setInitialWidth(900);
createAttentie.setInitialHeight(450);
createAttentie.setTitle("Nieuwe Attentie Aanmaken");
createAttentie.setContent(content);
createAttentie.show(target);
}
问候, 瑞克
In a Wicket Panel i implemented a method called showAttentiePopup(AjaxRequestTarget) which shows an ModalWindow popup screen. This method works fine when i call it from the same Panel. But when I try to call the method from another Panel it crashes with the following error:
java.lang.IllegalStateException: No Page found for component [MarkupContainer [Component id = createAttentie]]
at org.apache.wicket.Component.getPage(Component.java:1665)
at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:851)
at org.apache.wicket.Component.urlFor(Component.java:3170)
at org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractAjaxBehavior.java:123)
at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.getCallbackScript(AbstractDefaultAjaxBehavior.java:116)
at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.getCallbackScript(AbstractDefaultAjaxBehavior.java:104)
at org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow$CloseButtonBehavior.getCallbackScript(ModalWindow.java:876)
at org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow.getWindowOpenJavascript(ModalWindow.java:1005)
at org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow.show(ModalWindow.java:286)
at nl.topicuszorg.fks.web.client.dossier.overzichten.documenten.AttentieOverzichtPanel.showAttentiePopup(AttentieOverzichtPanel.java:171)
at nl.topicuszorg.fks.web.client.dossier.overzichten.documenten.EditFileDocumentPanel$2.onSubmit(EditFileDocumentPanel.java:195)
at org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink$1.onSubmit(AjaxSubmitLink.java:94)
at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:128)
at org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:163)
at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:297)
Someone an idea what the problem might be?
The method showAttentiePopup:
public void showAttentiePopup(AjaxRequestTarget target) {
Component content = new EditAttentiePanel(createAttentie.getContentId(), new Attentie(), EditFunctie.AANMAKEN) {
/** */
private static final long serialVersionUID = 1L;
@Override
protected void annuleren(AjaxRequestTarget target) {
FKSModalWindow.closeCurrentWindow(target);
}
@Override
protected void opslaan(AjaxRequestTarget target, Attentie attentie) {
//Inhoud even weggelaten
}
};
createAttentie.setOutputMarkupId(true);
createAttentie.setInitialWidth(900);
createAttentie.setInitialHeight(450);
createAttentie.setTitle("Nieuwe Attentie Aanmaken");
createAttentie.setContent(content);
createAttentie.show(target);
}
Greetings,
Rick
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的堆栈跟踪表明,当您的代码尝试渲染 ModalWindow createAttentie 时,它不是页面的一部分。
跟踪页面构造逻辑和组件结构,并确保所有内容都正确连接在一起。
Your stack trace indicates the ModalWindow createAttentie is not part of a page at the time your code is trying to render it.
Trace through your page construction logic and component structure and make sure everything is wired together correctly.