Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-1572

Ajax postcall handler only called once under specific condition

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.3.3
    • None
    • wicket
    • None
    • WinXP (build 1.6.0_05-b13)

    Description

      The problem is originally raised here: http://www.nabble.com/Ajax-postcall-handler-does-not-get-called-every-time-td16659218.html#a16663054

      0) Run the quickstart project
      1) Close all browser windows, then open a browser
      2) Visit the page (http://localhost:8080)
      3) click the link, postcall handler is called as expected
      4) any click again, postcall handler is not called

      Now the strange part

      0) Leave the browser window open, restart the quickstart project
      1) Visit the page (http://localhost:8080)
      2) click the link again and again and postcall handler is called every time as expected

      IE7, FF 2.0.0.14, Safari and Opera and all the same.

      AjaxRegisterPostCallHandler.java =====================================================

      public class AjaxRegisterPostCallHandler extends WebPage {
      private int count;

      private static HeaderContributor headerCont = new HeaderContributor(new IHeaderContributor() {
      public void renderHead(IHeaderResponse response) {
      response
      .renderOnLoadJavascript("Wicket.Ajax.registerPostCallHandler(function()

      {alert('ajax');}

      );");
      }

      });

      public AjaxRegisterPostCallHandler() {

      final WebMarkupContainer container = new WebMarkupContainer("container");
      container.setOutputMarkupId(true);
      add(container);

      Label label = new Label("count", new AbstractReadOnlyModel() {

      public Object getObject()

      { return count; }

      });
      container.add(label);
      container.add(new AjaxLink("link") {
      public void onClick(AjaxRequestTarget target)

      { count++; target.addComponent(container); target.appendJavascript(";"); }

      });

      add(headerCont);

      }
      }

      AjaxRegisterPostCallHandler.html ================================================

      <html>
      <head>
      <title>Test</title>
      </head>
      <body>
      <div wicket:id="container">
      <div wicket:id="count"></div>
      <a wicket:id="link">link</a>
      </div>

      </body>
      </html>

      Attachments

        Issue Links

          Activity

            People

              ivaynberg Igor Vaynberg
              matthewyoung Matthew Young
              Votes:
              3 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: