Reputation: 3897
On one page I have added two panels, see figures "select one or more"
and "select one"
. The figure "select one or more"
is the first panel
that is visible to the user when the page is loaded for the first time. After the user makes some selections he/she can click the next
button. Doing so, the other panel
"select one"
gets visible and the first panel gets invisible. Clicking on back
button the first panel gets visible and the second panel disappears. Doing a selection on the second panel and clicking on next the page "your selection"
gets open.
Everything works fine until I click on the back button of the browser
from the second page "your selection"
to the first page. Back on the first page the user sees the panel "select one or more"
but nothing works. When I click on the checkboxes I see in the debug:
BehaviorRequestTarget - component not enabled or visible; ignoring call. Component: [MarkupContainer [Component id = selection]]
And when I click on the next button
BehaviorRequestTarget - component not enabled or visible; ignoring call. Component: [MarkupContainer [Component id = next]]
This is the ajax debug text:
INFO: focus set on idb
INFO: Initiating Ajax POST request on ?wicket:interface=:2:allpopup:content:form:allItemsContainer:items:7:selectionContainer:selected::IBehaviorListener:0:&random=0.997746484662292
INFO: Invoking pre-call handler(s)...
INFO: Received ajax response (0 characters)
ERROR: Wicket.Ajax.Call.failure: Error while parsing response: Could not find root <ajax-response> element
INFO: Invoking post-call handler(s)...
INFO: Invoking failure handler(s)...
Any idea why this happen and what to do about it?
Thank you
Upvotes: 0
Views: 2078
Reputation: 383
I added the following to my BasePage.java file (which extends WebPage) to force page reload when the back browser button is clicked.
// Sets page reload on browser back button
@Override
protected void configureResponse() {
super.configureResponse();
WebResponse response = getWebRequestCycle().getWebResponse();
response.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate, no-store");
response.setHeader("Expires","-1");
response.setHeader("Pragma","no-cache");
}
I believe I got the suggestion from the following link: http://www.richardnichols.net/2010/03/apache-wicket-force-page-reload-to-fix-ajax-back/
Upvotes: 1