Wicket:打开 ModalWindow(弹出窗口)时崩溃

发布于 2024-08-25 05:54:59 字数 2809 浏览 2 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

熟人话多 2024-09-01 05:54:59

您的堆栈跟踪表明,当您的代码尝试渲染 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文