リソースはスタイルシートとして解釈されますが、MIMEタイプtext / htmlで転送されます



Resource Interpreted



The ContentType parameter in the response header must be consistent with the Accept parameter in the request header, such as application / javascript, text / css, text / html
If it is not consistent, it may cause the browser to not recognize the response content, The following figure shows the request and response headers of the correct css style file

変更方法に一貫性がない場合は、グローバルフィルターの応答ヘッダー設定を増やします。



String contextType = ((HttpServletRequest) request).getHeader('Accept') httpResponse.setContentType(contextType == null ? 'text/htmlcharset=utf-8' : contextType+'charset=utf-8')

私のプロジェクトはutf-8形式なので、ここではutf-8で記述しています。プロジェクトが別の形式の場合は、ここで別の形式に変更できます

また、実際の測定後、Tomcat7とTomcat8はここでは異なる方法で処理されます。 Tomcat8は上記の形式で記述する必要があり、Tomcat7はtext / htmlに設定できます。



参照リンク: https://blog.csdn.net/sky_cui/article/details/86703706