Something I just came across today whilst creating a BookmarkablePageLink, was an issue where it appeared that the parameters I was passing to the constructor where not being passed to the new instance. I orginally had something like:
PageParameters map = new PageParameters();
BookmarkablePageLink
if (testCondition) {
map.put(TeamtPage.TEAMID, teamId);
}
This did not work. However a quick look at the source code for BookmarkablePageLink reveals why:
this.parameters = pageParametersToMiniMap(parameters);
It is essentially creating a new Map which is stored in the class, and hence when adding items to the Map after calling the constructor does not work. Obvously the good code is:
PageParameters map = new PageParameters();
if (testCondition) {
map.put(TeamtPage.TEAMID, teamId);
}
BookmarkablePageLink
Anyhow whats the moral of this? make sure you have the source to Wicket in your IDE as one of the great things about this framework is that you can look at the very understandable source and see what is happening straight away







0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.