spring 和 apache 磁贴中 css 文件的错误 url
我正在创建基于 spring 和 apache 磁贴的 REST 应用程序。我添加了 .css 文件,在主页上它可以正常工作。我的意思是,当我在 domain.com/
上时,但是当我转到 domain.com/something/
时,网址是相同的,而且是错误的。我必须在 .css 文件路径的开头添加 ../
如何在每个子页面上创建(自动)正确的文件路径?
I'm creating REST application based on spring and apache tiles. I've added .css file and on main page it work everything. I mean when I'm on domain.com/
but when I'll go to domain.com/something/
the url is the same and it's wrong. I would have to add ../
at the start of .css file path
How can I create (by auto) correct file path on every subpage ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用绝对路径而不是相对路径:
而不是
您还必须确保 Web 应用程序的上下文路径始终放在前面,因此该路径实际上应该是
or,如果您使用 JSTL:
Use absolute paths rather than relative paths:
rather than
You must also make sure that the web app's context path is always prepended, so the path should in fact be
or, if you use the JSTL: