• 传值乱码解决方案


    1、在web.xml中配置编码方式


    <!-- spring Web MVC框架提供了org.springframework.web.filter.CharacterEncodingFilter用于解决POST方式造成的中文乱码问题 -->
    <filter>
    <filter-name>encodingFilter</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>
    </filter>
    <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- 处理中文乱码问题 start
    <filter>
    <filter-name>UTF-Encoding</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>UTF-Encoding</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping> -->

    2)接收的地方在上编码方式

    request.setCharacterEncoding("utf-8");
    response.setCharacterEncoding("utf-8");
    response.setContentType("text/html;charset=utf-8");

    3)在tomcat中server.xml的端口号后面加上

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

    4)热部署下ajax传值乱码

    <configuration>
    <port>8088</port>
    <path>/</path>
    <uriEncoding>UTF-8</uriEncoding>
    </configuration>

  • 相关阅读:
    GUI线程安全详解(二)
    如何用BlazeDS前后台数据交互
    定制Flex菜单图标
    Web App第三方组件PKDashcode&Sencha
    如何用BlazeDS更改图片
    GUI线程安全详解(一)
    Flex Spark皮肤定制
    GUI线程安全详解(三)
    (C# 基础) Array ( Copy, Clone, Clear etc.)
    System.ArgumentException: Destination array was not long enough.
  • 原文地址:https://www.cnblogs.com/joyous-day/p/6142248.html
Copyright © 2020-2023  润新知