assuming I have the following code in wicket
TextField foo = ...;
TextField bar = ...;
bar.add(new AjaxEventBehavior("change") {
@Override
protected void onEvent(AjaxRequestTarget target) {
// do something
}
});
let's further assume foo and bar are members of a form "dummyForm" wich has a CompoundPropertyModel as Model. The initial value of the "foo"-field is "Max"
Now I write a simple test with Wicket-Tester:
formtester.setValue("foo", "Petra");
wickettester.executeBehavior(...); // execute behaviour on field bar
wickettester.getRequest().getPostParameters();
wickettester.getComponentFromLastRenderedPage("foo").getDefaultModelObjectAsString();
When I execute this test the first line puts a post-parameter ("foo", "Petra") in the mock-request. Since the behaviour in the second statment is not a formsubmit-behaviour the CompoundPropertyModel gets not updated. So in line 4 the model-value of foo is still "Max" and not "Petra". I've noticed that the post-parameters got cleared after processing the behaviour, so also line three of my test offers me a empty list of parameters.
So now my question: What's the preferred way to "safe" request-parameter between non-form-submiting requests?
Thanks a lot for your answers
I'm afraid you will have to transfer them yourself. They are available in
#getLastRequest()instead of#getRequest().