web.xml里的welcome-file-list里设置默认访问页面为/html/index.html 
但是在访问时,页面CSS都没加载。 
正常输入网址却没问题。用/html/index.jsp也没问题。配置如下 
 <welcome-file-list> 
  <welcome-file>/html/index.html</welcome-file> 
 </welcome-file-list> 
CSS文件在与html文件夹同级的app目录里。html文件里的CSS路径为:app/main.css。 
因为直接输入index.html打开是不会有问题的。 
http://localhost:8080/项目   打开就会丢失CSS 
http://localhost:8080/项目/html/index.html  就不会丢失 

解决方法:

CSS路径不要用相对路径,写成绝对路径

相关文章:

  • 2021-07-25
  • 2021-07-31
  • 2022-12-23
  • 2022-12-23
  • 2021-05-01
  • 2022-01-02
  • 2021-11-20
猜你喜欢
  • 2022-12-23
  • 2022-01-23
  • 2021-07-10
  • 2021-12-11
  • 2021-06-05
  • 2021-05-26
  • 2021-07-26
相关资源
相似解决方案