I have Wicket app, in WebApplication I do:
public class AppStart extends WebApplication{
public AppStart(){
}
@Override
protected void init(){
super.init();
mountPage("/index.html", StandardPage.class);
mountPage("/another.html", StandardPage.class);
}
}
but when I access /index.html then I'm redirected to /another.html page. Has been thinking that at the moment of creating page StandardPage.class will be instantiated so these two pages will be handled by two separate objects of StandardPage.class?
yes, it is true. Wicket has its own complex mechanism of handling URLs and how to redirect browser to a specific target. In Wicket using two or more different paths to mount the same page class has no idea (by default).
SOLUTION 1
If you really want to get the same functionality on different URLs, use a simple descendant
Your code
Do not forget to use correctly
or
SOLUTION 2
The following example shows how you can use a page parameter as a part of URL. Let's there are users in a databases and each user has its own page that is accessible on a unique URL. Also each user can do some optional operations and the operation name is ever included in URL and there are some other pages mounted to their own URIs. So URIs should look like
In this case it is possible to use the default MontedMapper, that is ever implemented in Wicket. The mapping is
and you have to implement the UserProfilePage and its constructor with PageParameters
SOLUTION 3
Also you can override IRequestMapper and some other classes, but I think it is too much complicated and it is not necessary in your case.