1. 程式人生 > 其它 >Maven 配置WEB專案時, 不能正常解碼請求的中文資訊

Maven 配置WEB專案時, 不能正常解碼請求的中文資訊

查詢了瀏覽器提交的資訊,中文資訊是正常進行uri編碼的,但是實際獲取到的資料確實亂碼;

需要在配置maven中配置tomcat外掛時 明確清楚uriEncoding的方式,即可解決這個問題;

        <!--tomcat外掛-->
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <!-- tomcat7的外掛, 不同tomcat版本這個也不一樣 -->
                <
artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <configuration> <!-- 通過maven tomcat7:run執行專案時,訪問專案的埠號 --> <port>80</port> <!-- 專案訪問路徑 本例:localhost:9090, 如果配置的aa, 則訪問路徑為localhost:9090/aa
--> <uriEncoding>UTF-8</uriEncoding> <path>/travel</path> </configuration> </plugin>