java - 实现 MixedParamUrlCodingStrategy 会阻止我的网站使用 CSS

标签 java css wicket

我在 Wicket 中开发了一个带有 CSS 样式左侧菜单的应用程序。一切正常。然后,为了使 URL 成为 RESTful,我将 WicketApplication.java 更改为使用 MixedParamUrlCodingStrategy。从那时起,这种风格就停止了。我不知道问题出在哪里。我没有改变任何其他东西。这是我的代码:

mount("/site",PackageName.forPackage(WelcomePage.class.getPackage()));
//
mount("/download",PackageName.forPackage(AppDownloadApi.class.getPackage()));

// mountBookmarkablePage("push/reg", PushRegApi.class);
   mountBookmarkablePage("push/send", PushMessageApi.class);
   mountBookmarkablePage("device", DeviceprofileExportAsXML.class);
// mountBookmarkablePage("app/download", AppDownloadApi.class);
// mountBookmarkablePage("ds/export", ExportDataSource.class);
// mountBookmarkablePage("control/export", ExportAsXML.class);

MixedParamUrlCodingStrategy ds = new MixedParamUrlCodingStrategy(
    "ds", ExportDataSource.class, new String[]{"name"});
mount(ds);

MixedParamUrlCodingStrategy control = new MixedParamUrlCodingStrategy(
    "control", ExportAsXML.class, new String[]{"controlName"});
mount(control);

MixedParamUrlCodingStrategy app = new MixedParamUrlCodingStrategy(
    "app", AppDownloadApi.class, new String[]{"appId"});
mount(app);

MixedParamUrlCodingStrategy pushReg = new MixedParamUrlCodingStrategy(
    enter code here  "push/reg", PushRegApi.class, new String[]{"appName",
    "groupName","userName","password","deviceToken"});
mount(pushReg);

如果我取消注释,并删除 MixedParamUrlCodingStrategy,那么一切正常。我怎样才能同时拥有 RESTful URL 和我想要的样式?

最佳答案

这可能与您将 CSS 链接到页面的方式有关。刚开始时我们遇到了类似的问题,因为我们将 CSS 的路径硬编码到页面中,但是当我们更改某些页面的映射时,CSS 文件的相对路径不再有效。

我建议使用 FireBug 并检查“网络”选项卡以查看 CSS 是否正在加载,如果是,请求返回的内容是什么。

您可能需要使用 CSSPackageResource.getHeaderContributer 之类的东西将 css 正确链接到页面。

关于java - 实现 MixedParamUrlCodingStrategy 会阻止我的网站使用 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7807021/

相关文章:

java - Java 常量对象的命名约定

javascript - 网格元素单击事件在移动设备等小屏幕上不起作用

java - 单击按钮后不开始下载

java - 如何删除 Hashmap 中重复的键值对? - 不只是复​​制键或值

java - 在方法中修改了对象内容,但对象哈希码保持不变

java - 异步类不传递参数

javascript - 屏幕阅读器会关注 CSS 吗?

css - 翻转动画在 Chrome 中可以正常工作,但在 Safari 中不行

wicket - Wicket 模型如何与泛型一起使用?

javascript - Wicket AjaxNewWindowNotifyingBehavior 和后退按钮