質問

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?

役に立ちましたか?

解決

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.

他のヒント

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));
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top