Quantcast
Channel: Wicket Game (Entries tagged as guildwars assistant)
Viewing all articles
Browse latest Browse all 6

Access PageParameter objects from your Panel in a testable way

$
0
0

When trying to build stateless pages without the user noticing, like building an application using AjaxFallBackLinks and reusing the fall-back to provide a search-engine-friendly version of your application, you've got to put the state into PageParamaters, which can be transported via bookmarkable links.

The most obvious way to access these Parameters from your Panel is a simple getPage().getPageParameters(). But as simple as it looks this is bad in a couple of ways. First it introduces tight coupling between your Panel and Page, which makes it hard to test (as in: you need to provide a page to test the Panel.). Second getPage() isn't available on construction-time. So calling getPage().getPageParameters() in the panel's constructor throws a NullPointerException.

If it's hard to test you're probably doing it wrong.


Continue reading "Access PageParameter objects from your Panel in a testable way"

Viewing all articles
Browse latest Browse all 6

Trending Articles