Wicket: Loose Coupling of Componens for Ajax Updates
September 13th, 2008 by Stefan Fußenegger | Published in WicketWhile developing Wicket applications, one often has to write a simple input form (e.g. a search box) that updates the content of another panel (e.g. a search result panel). And of course, we all use Wicket’s AJAX support to search as it is so damn cool and easy to use.
Normally, you do this by either putting everything on one panel or by passing a reference of the list panel to the form panel.
public SearchBoxPanel(String id, SearchResultPanel results) { _results = results; // snip } public void onSubmit(AjaxRequestTarget target) { _results.setQuery(getQuery()); // or use the same model ;) target.add(_results); }