我在 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/