使用wicket中的inlineframe创建打印弹出窗口

使用wicket中的inlineframe创建打印弹出窗口,wicket,Wicket,我想使用InInframe显示弹出预览打印页面,这是我的问题: 爪哇: 因为当我用标签替换它时,它工作正常,但我不知道问题出在哪里不完全清楚问题出在哪里(一些代码明显缺失)。看起来您正在添加新组件,而不是替换旧组件 试着这样做: public class HomePage extends WebPage { private InlineFrame iframe = new InlineFrame("iframe", new OtherPage()); public HomePa

我想使用InInframe显示弹出预览打印页面,这是我的问题:

爪哇:


因为当我用标签替换它时,它工作正常,但我不知道问题出在哪里

不完全清楚问题出在哪里(一些代码明显缺失)。看起来您正在添加新组件,而不是替换旧组件

试着这样做:

public class HomePage extends WebPage {
    private InlineFrame iframe = new InlineFrame("iframe", new OtherPage());

    public HomePage() {
        iframe.setOutputMarkupId(true);

        Form form = new Form("form");
        form.setOutputMarkupId(true);
        form.add(new AjaxSubmitLink("test") {
            @Override
            protected void onSubmit(AjaxRequestTarget art, Form<?> form) {
                InlineFrame newIframe = new InlineFrame("iframe", new OtherPage());
                iframe.replaceWith(newIframe);
                iframe = newIframe;
                art.add(iframe);
            }
        });
        add(form, iframe);
    }
}
公共类主页扩展网页{
private InlineFrame iframe=新的InlineFrame(“iframe”,new OtherPage());
公共网页(){
iframe.setOutputMarkupId(true);
表格=新表格(“表格”);
form.setOutputMarkupId(true);
添加(新的AjaxSubmitLink(“测试”){
@凌驾
提交时受保护的无效(AjaxRequestTarget艺术、形式){
InlineFrame newIframe=新的InlineFrame(“iframe”,new OtherPage());
iframe.replacetwith(newIframe);
iframe=新iframe;
第条添加(iframe);
}
});
添加(表格,iframe);
}
}
重要的是

  • 调用
    replaceWith
    ,以便Wicket可以相应地更新组件树
  • 更改iframe的引用以指向新组件

只需更换上一帧

        @Override
        public void onClick(AjaxRequestTarget target) {
            InlineFrame newIframe = new InlineFrame("iframe", PersonalInformationPage.class);
            iframe.replaceWith(newIframe);
            iframe = newIframe;
            target.add(iframe);
        }
WicketMessage: org.apache.wicket.WicketRuntimeException: component form:panel:panel:panel:mcGridViewInfo:GridViewInfo:form:<b>test not found on page</b> ir.mersad.ui.authenticationAndAuthorization.Office[id = 1], listener interface = [RequestListenerInterface name=IActivePageBehaviorListener, method=public abstract void org.apache.wicket.behavior.IBehaviorListener.onRequest()]

Root cause:

org.apache.wicket.WicketRuntimeException: component form:panel:panel:panel:mcGridViewInfo:GridViewInfo:form:test not found on page ir.mersad.ui.authenticationAndAuthorization.Office[id = 1], listener interface = [RequestListenerInterface name=IActivePageBehaviorListener, method=public abstract void org.apache.wicket.behavior.IBehaviorListener.onRequest()]
at org.apache.wicket.request.AbstractRequestCycleProcessor.resolveListenerInterfaceTarget(AbstractRequestCycleProcessor.java:427)
at org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:472)
at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:144)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1339)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1465)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

Complete stack:

org.apache.wicket.protocol.http.request.InvalidUrlException: org.apache.wicket.WicketRuntimeException: component form:panel:panel:panel:mcGridViewInfo:GridViewInfo:form:test not found on page ir.mersad.ui.authenticationAndAuthorization.Office[id = 1], listener interface = [RequestListenerInterface name=IActivePageBehaviorListener, method=public abstract void org.apache.wicket.behavior.IBehaviorListener.onRequest()]
at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:262)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1339)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1465)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
container.add(new InlineFrame("printPage", new EmptyPage()));
public class HomePage extends WebPage {
    private InlineFrame iframe = new InlineFrame("iframe", new OtherPage());

    public HomePage() {
        iframe.setOutputMarkupId(true);

        Form form = new Form("form");
        form.setOutputMarkupId(true);
        form.add(new AjaxSubmitLink("test") {
            @Override
            protected void onSubmit(AjaxRequestTarget art, Form<?> form) {
                InlineFrame newIframe = new InlineFrame("iframe", new OtherPage());
                iframe.replaceWith(newIframe);
                iframe = newIframe;
                art.add(iframe);
            }
        });
        add(form, iframe);
    }
}
        @Override
        public void onClick(AjaxRequestTarget target) {
            InlineFrame newIframe = new InlineFrame("iframe", PersonalInformationPage.class);
            iframe.replaceWith(newIframe);
            iframe = newIframe;
            target.add(iframe);
        }