前言
写好的bbs项目发布到linux系统上出现了样式错误,找不出错来,在大佬的帮助下,解决错误。
过程
经过测试,发现windows的tomcat8显示正常,linux的tomcat7显示正常,但是linux的tomcat8显示不正常。
正常的response Content-Type为text/css
乱码的response Content-Type为text/html
然后在tomca8.5的web.xml中
发现了
<mime-mapping>
<extension>css</extension>
<mime-type>text/css</mime-type>
</mime-mapping>
作用是将css后缀的文件返回为content-type为text/css。
从上面的两张图可以看出,都没有返回正确,所以猜想我们的代码强制设置了content-type头。
最终在过滤器中发现了
response.setContentType("text/html;charset=utf-8");
删完收工
热泪盈眶。。。。
推销一波我们写好的项目——bbs
总结:windows上的tomcat感觉限制好低,放到linux上瞬间就不行了。。。