| Apache Wicket > Framework Documentation > Reference library > How to do things in Wicket > Forms > Passing parameters to pages |
Adding the parameters in your WebPage:
... PageParameters params = new PageParameters(); params.put("param", "value"); setResponsePage(PageToRetrieveParams.class, params); ...
Retrieving the parameters in your WebPage:
... public PageToRetrieveParams(PageParameters p) { p.getString("param"); } ...
In your WebApplication:
... public Class<? extends WebPage> getHomePage() { return HomePage.class; } ...
In your HomePage:
... public HomePage() { // Check the current state of everything before passing the parameters if (state == WORLD) { throw new RestartResponseException(PageWeArePassingParamsTo.class, new PageParameters(...)); } } ...
Adding the parameters in your WebPage:
...
RequestCycle.get().getPageParameters().put("myObject", myObect);
...
Retrieving the parameters in your WebPage:
...
MyObject myObect = (MyObect)getWebRequestCycle().getPageParameters().get("myObject");
...