API / Apache Wicket Interview questions
What is the difference between an AjaxLink and a Link in Wicket?
Both trigger server-side Java code when clicked, but they differ in how the browser communicates that click back to the server and how much of the page changes as a result.
| Link | AjaxLink |
| Full HTTP request, standard browser navigation | Asynchronous XHR request via JavaScript |
| Entire page is re-rendered and reloaded | Only explicitly targeted components are updated |
| Works even with JavaScript disabled | Requires JavaScript enabled in the browser |
| Override onClick() with no target parameter | Override onClick(AjaxRequestTarget target) |
The practical choice depends on the interaction: a "sign out" link that legitimately navigates away is a natural fit for Link, while a "toggle favorite" star or a live-updating table filter belongs to AjaxLink, since re-rendering the entire page for a small in-place change would be wasteful and jarring for the user.
More Related questions...