Wicket problems & solutions

So, I’m learning a lot about Wicket lately. Here’s a couple things I’ve learned:

If you’re using the CheckBoxTree from the openCDMS, make sure you get the most recent version. The revision linked to in the Google search results is old, and does not include CheckBoxIconPanel.html. It took me a while to realize what the problem was, because Wicket Components will use the HTML file of their superclass if one is not provided. Here’s a link to the most recent version.

Another issue I recently ran into is that an AJAX Component on my page would get redrawn for the first AJAX call, but not for subsequent calls, even though I added it to the AjaxRequestTarget. Looking at the handy in-page Wicket AJAX debug, I saw,

“ERROR: Wicket.Ajax.Call.processComponent: Component with id [[selectedFeaturesContainera]] a was not found while trying to perform markup update. Make sure you called component.setOutputMarkupId(true) on the component whose markup you are trying to update.”

I was indeed calling setOutputMarkupId(true). The problem was actually that I was using a <wicket:container> for that Component. The <wicket:container> was present with the proper id in the HTML of the initial page load, but would not be included in the document replacing it during the AJAX call. As a result, subsequent calls could not find the element to replace.

The solution: use a real HTML element for every element that has setOutputMarkupId(true). Also, remember that if you’re using using id selectors in your stylesheets, you need to be careful of setOutputMarkupId(true) because your id hard-coded in the HTML will get replaced/overwritten by Wicket’s automatically generated id.

4 thoughts on “Wicket problems & solutions”

  1. Thanks so much for this post! I ran in to the same problem. You’ve saved me a long night of hair pulling.

  2. I was getting the same ERROR, but the problem was that I was doing a setVisible(false) on my component at some point.
    The solution was to call setOutputMarkupPlaceholderTag(true) in addition to setOutputMarkupId(true) on the component.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.