tomcat 加载HTML页面 中文乱码解决
<welcome-file-list>
<welcome-file>index.jhtml</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<mime-mapping>
<extension>htm</extension>
<mime-type>text/html;charset=utf-8</mime-type>
</mime-mapping>
<mime-mapping>
<extension>html</extension>
<mime-type>text/html;charset=utf-8</mime-type>
</mime-mapping>
</web-app>
如上,如果在HTML页面设置了utf-8编码,并且页面文件设为utf-8仍未解决乱码问题,则可在web项目下的web.xml文件添加配置
<mime-mapping>
<extension>htm</extension>
<mime-type>text/html;charset=utf-8</mime-type>
</mime-mapping>
<mime-mapping>
<extension>html</extension>
<mime-type>text/html;charset=utf-8</mime-type>
</mime-mapping>
即可解决乱码问题!