2011-10-18 29 views
0

我使用CSS樣式的左側菜單在Wicket中開發了一個應用程序。一切正常。然後,爲了使URL成爲RESTful,我將WicketApplication.java更改爲使用MixedParamUrlCodingStrategy。從那時起,風格停止工作。我不知道問題出在哪裏。我沒有改變任何東西。這裏是我的代碼:實現MixedParamUrlCodingStrategy可以防止我的網站使用CSS

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和我想要的樣式?

+0

你確定如果你刪除MixedParamUrlCodingStrategy的CSS再次正常工作?這隻會改變構建BookmarkablePages的URL的方式。即使在css中使用相對路徑,它們是相對於css而不是當前文檔,所以我不明白爲什麼會發生這種情況。 –

+0

是的。它工作,如果我刪除MixedParamUrlCodingStrategy並安裝包。這是什麼解決方案。 – VNR

+0

請發佈不當行爲的CSS部分,相關HTML部分以及帶和不帶MixedParamUrlCodingStrategy的URL。 –

回答

0

這可能是您如何將CSS鏈接到頁面的問題。第一次啓動時,我們遇到了類似問題,因爲我們已經將CSS路徑硬編碼到頁面中,但是當我們更改某些頁面的映射時,CSS文件的相對路徑不再有效。

我會建議使用FireBug並檢查Net標籤以查看CSS是否正在加載,如果是的話請求返回的內容是什麼。

您可能需要使用類似CSSPackageResource.getHeaderContributer的CSS正確鏈接到頁面。