Question

I am trying to get around a peculiarity with Wicket pages—I have a page containing an ajax tabbed panel, and would like to make it so the user can alter the URL so that the next time the page displays, the tab is the one specified in the URL.

Example:

The user would click on a link elsewhere in the system that would take them to: http://example.com/customer/edit?tab=summary

(This gets changed by wicket to include a version number: http://example.com/customer/edit?1&tab=summary)

This would show the first tab as expected, but

If the user altered the url to http://example.com/customer/edit?1&tab=orders

Then the user would expect the orders tab to be displayed, but it isn't. It still displays the summary tab.

The problem is that the Page class is only ever given parameters on construction, so getPageParameters().get( "tab" ); would always be 'summary', unless the user alters that number that always gets appended to the params to one not already used. Then a new instance of the page is created with a fresh set of params.

Is there a way to make it so when the page is refreshed, it picks up the new url parameters of the request in onConfigure?

Was it helpful?

Solution

Try using the actual request parameters instead:

RequestCycle.get().getRequest().getQueryParameters()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top