服务器的默认编码配置之tomcat及maven的配置

1.tomcat 修改配置文件server.xml
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" URIEncoding ="UTF-8"/>
添加URIEncoding="UTF-8"即可

2.maven插件添加配置 如下

             <!-- tomcat运行插件 -->
              <plugin>
              <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <configuration>
                <port>80</port>
                <path>/gome</path>
                <uriEncoding>UTF-8</uriEncoding>//添加此项即可
            </configuration>
              </plugin>

你可能感兴趣的:(服务器编码)