First, I set my URL strategy to make it bookmarkable:
MixedParamUrlCodingStrategy mypageURL = new MixedParamUrlCodingStrategy(
"/service/test",
MyPage.class,
new String[]{"type"}
);
mount(mypageURL);
Then, in the page code, I override the form onSubmit() method to do the following:
form.add(new SubmitLink("update") {
@Override
public void onSubmit() {
PageParameters parameters = new PageParameters();
parameters.add("period", Integer.toString(getPeriod()));
parameters.add("unit", getUnit().toString());
parameters.add("type", getType());
setResponsePage(getPage().getClass(), parameters);
}
});
So, after the user click on the submit link, it submits it similarly to a GET method and I get a nice URL like:
https://localhost:5443/application/service/test/app/?unit=HOUR&period=6
The result is that this makes URLs much more bookmarkable throughout the session.
1 comments:
QueryStringUrlCodingStrategy mypageURL = new QueryStringUrlCodingStrategy("/search",
SearchResults.class);
mount(mypageURL);
then you can use urls: /search?term=monkey
Post a Comment