I think I may have found a bug with header contributions, AjaxLink, and
Internet Explorer. Here's a test page:

<html>
  <body>
    <div wicket:id="subComponent"></div>
  </body>
</html>

---8<---

public class TestPage extends WebPage {
    public TestPage() {
        add(new SubComponent("subComponent"));
    }
}



SubComponent is defined as follows:

<html>
  <head>
    <wicket:head>
      <wicket:link>
        <link rel="stylesheet" type="text/css" href="SubComponent.css">
      </wicket:link>
    </wicket:head>
  </head>
  <body>
  
<wicket:panel>
    <a wicket:id="link" href="#">Click Me</a>
    <span wicket:id="label"></span>
</wicket:panel>

  </body>
</html>

---8<---

public class SubComponent extends Panel {

    private int count = 0;
    
    public SubComponent(String id) {
        super(id);
        
        add(new AjaxLink("link") {
            @Override
            public void onClick(AjaxRequestTarget target) {
                count++;
                target.addComponent(SubComponent.this);
            }
        });

        add(new Label("label", new PropertyModel(this, "count")));
        
        setOutputMarkupId(true);
    }

    public int getCount() {
        return count;
    }

}




Under Firefox this works fine: clicking the Click Me link causes the
count to increment on the page. But under IE, the number does not get
updated on the page (even though the count is being incremented on the
server). The debug window gives the following error:

INFO: 
INFO: Initiating Ajax GET request on
/arp/?wicket:interface=:0:subComponent:link::IBehaviorListener&wicket:behaviorId=0&random=0.8818904450460203
INFO: Invoking pre-call handler(s)...
INFO: Received ajax response (656 characters)
INFO: 
<?xml version="1.0"
encoding="UTF-8"?><ajax-response><header-contribution><![CDATA[<head
xmlns:wicket="http://wicket.sourceforge.net";> 
       
        <link
href="/arp/resources/com.td.idcs.arp.dev.SubComponent/SubComponent_en_US.css"
rel="stylesheet" type="text/css"> 
       
    </head>]]></header-contribution><component id="subComponent"
><![CDATA[<div id="subComponent"> 
    <a href="#" onclick="var
wcall=wicketAjaxGet('/arp/?wicket:interface=:0:subComponent:link::IBehaviorListener&wicket:behaviorId=0',
function() { }, function() { });return !wcall;"
id="subComponent_link">Click Me</a> 
    <span>3</span> 
</div>]]></component></ajax-response>
ERROR: Error while parsing response: Object required
INFO: Invoking post-call handler(s)...
INFO: Invoking failure handler(s)...




The problem appears to be the <wicket:head> portion of the SubComponent.
Comment this out and it works correctly on both IE and Firefox. Note
that SubComponent.css is empty. I've tried this on Wicket 1.2.4 and 1.2.6.

Any thoughts?

jk


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to