问题描述:

I creating a simple web page in Wicket 6.x, which also has a background image.

The landing page, which is localhost:8080, has the css defined in the html document as :

 <style>

html,body{

background: url("bg.png");

}

</style>

bg.png is stored in src/main/webapp, and seems to work fine.

But once it goes to the next page, in which I have defined the css in the same way, the image does not show. On clicking the generated url, which is localhost:8080/wicket/bookmarkable/bg.png, the page says "resource not found".

Where do I keep my css resources and what should be the correct path? Also, is there any method or initialization I need to do in my java class file as well?

网友答案:

Use "/bg.png" as a path. This is context absolute path and will work no matter what is the url of the current page.

相关阅读:
Top