• 通过TomCat获取html文件时中文乱码


    前提:通过ajax获取json文件,在各编辑器中自带服务器,可以访问到文件内容,通过TomCat获取时,报错。

    虽然是直接请求的html路径 ,但是还是会经过服务器端如tomcat来返回该html页面。而有的时候服务器的编码格式你也不好改变。  在网上找了很多。最后找到在web.xml里设置这些就可以解决html乱码问题。

    <jsp-config>  
         <jsp-property-group>  
             <description>  
                 Special property group for JSP Configuration JSP example.  
             </description>  
             <description>  
                 Special property group for JSP Configuration JSP example.  
             </description>  
             <display-name>JSPConfiguration</display-name>  
             <url-pattern>*.html</url-pattern>  
             <el-ignored>true</el-ignored>  
             <page-encoding>UTF-8</page-encoding>  
             <scripting-invalid>false</scripting-invalid>  
             <include-prelude></include-prelude>  
             <include-coda></include-coda>  
         </jsp-property-group>  
     </jsp-config>  

    要记得加载顺序。比过滤器先就可以了。 例如在struts配置前面就可以了。

  • 相关阅读:
    关于多态
    关于lock锁
    wait()和notify()
    多线程之间的通讯
    多线程的异步请求模式
    合理配置线程池
    自定义线程池
    Curl的毫秒超时的一个”Bug”
    Nginx正确记录post日志的方法
    NGINX的奇淫技巧 —— 5. NGINX实现金盾防火墙的功能(防CC)
  • 原文地址:https://www.cnblogs.com/tiantianxiangshang33/p/5821564.html
Copyright © 2020-2023  润新知