Question

my map is

mountPage("/page/#{code}/#{name}", Page.class);

but when I click on the link

localhost/page/10/toy?2

wicket add also one parameter like a counter, when I refresh the page I have

localhost/page/10/toy?3

why?

Was it helpful?

Solution

This is because your page are stateful, Wicket manages its own states to your page by appending this "counter". This way, when your user navigate backward using its browser built-in functionnality, the page is displayed has it has been previously.

If you don't want such a parameter in your URL, you'll need to dig out and eradicate every stateful component in your pages.

OTHER TIPS

You can create

public class MountedMapperWithoutPageComponentInfo extends MountedMapper {

public MountedMapperWithoutPageComponentInfo(String mountPath, Class<? extends IRequestablePage> pageClass) {
    super(mountPath, pageClass, new PageParametersEncoder());
}

@Override
protected void encodePageComponentInfo(Url url, PageComponentInfo info) {

}

@Override
public Url mapHandler(IRequestHandler requestHandler) {
    if (requestHandler instanceof ListenerInterfaceRequestHandler) {
        return null;
    } else {
        return super.mapHandler(requestHandler);
    }
}

}

and map page on Application class like this

mount(new MountedMapperWithoutPageComponentInfo("/page/#{code}/#{name}", Page.class));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top