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.
2 comments:
It is extremely interesting for me to read this blog. Thank you for it. I like such topics and everything connected to this matter. I would like to read more on that blog soon.
It was very interesting for me to read this blog. Thanx for it. I like such topics and anything connected to this matter. I definitely want to read a bit more on that blog soon.
Post a Comment