挂载带有“/"路径的页面 [英] mount page with path to "/"
问题描述
我正在尝试使用 wicket 中的 mountPage 将 "/" url 挂载为我的 MainPage url.
Im trying to use mountPage in wicket to mount "/" url as my MainPage url.
我的 Web 应用程序现在看起来像这样:
My WebApplication looks like this now:
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 );
}
}
并且实际上效果很好,但我想将/home"更改为/",但它与CSS混淆了很多,例如,不是传输它,而是整个HomePage.我怎样才能按照我想要的方式进行这项工作?
and actually works great, but I'd like to change "/home" into "/", yet it messes a lot with CSS for example, not transfering it, but whole HomePage instead. How can I make this work the way I want to?
推荐答案
从 wicket 1.5 开始你可以申请 HomePageMapper ,旨在将请求映射到根路径.实际上 HomePageMapper 将由 wicket 自动应用于您的 WebApplication
的 ClassgetHomePage()
这样你的主页就会被挂载到根目录
Since wicket 1.5 you can apply HomePageMapper , it is designed to map requests to root path. Actually the HomePageMapper will be applied by wicket automatically for the page provided in your WebApplication
's Class<? extends Page> getHomePage()
so that your homepage will be mounted to path root
这篇关于挂载带有“/"路径的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!