2012-05-21 25 views
1

我试图在wicket中使用mountPage将“/”url装载为我的MainPage url。装载页面的路径为“/”

我的WebApplication现在看起来是这样的:

public class WicketApplication extends WebApplication 
{ 
@Override 
public Class<HomePage> getHomePage() 
{ 
    return HomePage.class; 
} 

@Override 
public void init() 
{ 
    super.init(); 
    mountPages(); 
} 

private void mountPages() 
{ 
    mountPage("/home", HomePage.class); 
    mountPage("/about", AboutCompany.class); 
    mountPage("/prices", Prices.class); 
    mountPage("/gallery", Gallery.class); 
    mountPage("/contact", Contact.class); 
    mountPage("/offer", Offer.class); 
} 
} 

和实际工作很好,但我想“/家庭”转变为“/”,但它搅乱了很多与CSS例如,不转移它,而是整个HomePage。我如何按照我想要的方式进行这项工作?

+2

只需删除“mountPage(”/ home“,HomePage.class);” 。 –

回答

3

由于wicket 1.5可以应用HomePageMapper,它旨在将请求映射到根路径。实际上,HomePageMapper将自动应用于您的WebApplicationClass<? extends Page> getHomePage()中提供的页面,以便您的主页将被安装到路径根