Hello,

I'm having difficulties using iframe inside a webpage, as the destination page of my iframe is loaded twice.

Example code:

MainPage.html
<form wicket:id="webForm">
   <input type="submit" wicket:id="btnSubmit"/>
</form>
<iframe wicket:id="iFrame"></iframe>

MainPage.java
private WebMarkupContainer iFrame = null;
public MainPage() {
  iFrame = new WebMarkupContainer("iFrame");
  iFrame.setOutputMarkupId(true);
  add(iFrame);
 
  Form webForm = new Form("webForm");
  webForm.add(new AjaxSubmitButton("btnSubmit", webForm){
    protected void onSubmit(AjaxRequestTarget target, Form form) {
      iFrame.add(new SimpleAttributeModifier("src", urlFor(PageMap.forName("subpage"), SubPage.class, null)));
      target.addComponent(iFrame);
    }
  });
  add(webForm);
}

There will be two SubPage-instances created with different pagemap (first time "subpage", second time "wicket-0").
When looking into this, I saw in the wicket.markup.html.WebPage, that the location is set again with different pagemap.

I tried also 2 other options :

1. Set the pagemap in the constructor of the SubPage : super(PageMap.forName("subpage"));

2. Use wicket.markup.html.link.InlineFrame instead of WebMarkupContainer. With this last one, I'm not sure I implemented it right.
    iFrame = new InlineFrame("iFrame", PageMap.forName("subpage"), SubPage.class);
    // I want an empty iframe the first time
    iFrame.add(new SimpleAttributeModifier("src", ""));
    iFrame = new WebMarkupContainer("iFrame");
    iFrame.setOutputMarkupId(true);
    add(iFrame);
   
    Form webForm = new ...

When testing all the above, sometimes I ran into a neverending cycle, because the window.location is set everytime.

What is the solution? I know that using no iframes is the best one, but I have a searchbox + underneath my results.
Only the results may be scrollable, so the searchbox is always visible.

Thanks in advance !
**** DISCLAIMER ****
http://www.tvh.be/newen/pages/emaildisclaimer.html

"This message is delivered to all addressees subject to the conditions set forth in the attached disclaimer, which is an integral part of this message."
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to