zoukankan      html  css  js  c++  java
  • 浏览器中文乱码,组合项目中部分模块乱码

    使用tomcat乱码

    1.在tomcat的conf/server.xml中的connector,添加URIEncoding=utf-8; 

    <Connector port="8081" protocol="HTTP/1.1" connectionTimeout="200000" URIEncoding="UTF-8"/>

    2. 在tomcat的bin/catalina.sh中加JAVA_OPTS

    JAVA_OPTS="-Xms1024m -Xmm4096m -Dfile.encoding=utf-8"

    CATALINA_OPTS="-Dfile.encoding=utf-8"

    3.添加 encoding filter,使得encoding filter就在servlet下面;中间不能有其他filter.

    <servlet>

    <servlet-name>springmvc</servlet-name>

    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

    </servlet>

    <servlet-mapping>

    <servlet-name>springmvc</servlet-name>

    <url-parttern>*.do</url-parttern>

    </servlet-mapping>

    <servlet-name>springmvc</servlet-name>

    <url-parttern>/web/*</url-parttern>

    </servlet-mapping>

    <filter>
    <filter-name>CharacterEncoding</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
    <param-name>encoding</param-name>
    <param-value>UTF-8</param-value>
    </init-param>
    <init-param>
    <param-name>forceEncoding</param-name>
    <param-value>true</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>CharacterEncoding</filter-name> 
    <url-pattern>/*</url-pattern>
    </filter-mapping>

  • 相关阅读:
    Yii Listview 更新及搜索
    Yii框架CGridView columns中使用数组或变量传值
    冲刺七天---05
    冲刺七天---04
    爱心图书剧本描述
    冲刺七天----03
    冲刺七天---02
    冲刺七天---01
    PSP周总结03
    psp周总结02
  • 原文地址:https://www.cnblogs.com/itdev/p/6510761.html
Copyright © 2011-2022 走看看