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

IBehavior#rendered() is called twice when a component that has that behavior is rendered via AJAX

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0 branch (discontinued)
    • wicket
    • None
    • Wicket 2.0

    Description

      The IBehavior#rendered() method is called twice when a component that has that behavior is rendered via AJAX. When rendering the component though the normal process (not ajax) it is only called once.

      Here are the two places it's getting called:

      The AjaxRequestTarget#respondComponent() method calls component.renderComponent() which tells the behaviors that the component was rendered (line 464 of AjaxRequestTarget.java ).

      The AjaxRequestTarget#respondHeaderContribution() method goes calls each component's renderedBehaviors() method which ends up calling IBehavior#rendered() (lines 513 and 524 of AjaxRequestTarget.java).

      The result of this is that Firefox, Safari, and Opera (I don't know about IE) end up executing any javascript that's rendered through a behavior twice.

      The example I tested was adding an AutoCompleteTextField to a page through ajax.

      Attachments

        Activity

          People

            Unassigned Unassigned
            redhatdude Caleb Land
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: