How to solve the problem of THE SSM framework in detail

  • 2020-12-05 17:15:38
  • OfStack

Doing a SSM framework project recently, always had a problem, is the background to receive front-end passing parameters in Chinese, parameter is gibberish, cause sql statements are often unable to perform, but there are strange, in the test environment and production environment are normal, local development environment is always so traps, and how to solve?

1, more tiring, is not to pass Chinese not pass Chinese parameters, for this, we just smile on the line...

2, still very tired, really have to transmit Chinese, then the Chinese mandatory transcoding, as follows:


" Chinese ".getBytes("UTF-8");

As for the second point, you can have a try. The third point is the radical solution. After a long time of searching, it turned out to be the configuration problem of tomcat.


<Connector port="8080" protocol="HTTP/1.1"
        connectionTimeout="20000"
        redirectPort="8443"/>

Then add the following sentence to configure URIEncoding=" ES20en-8 ":


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

Here is the perfect solution, the treasure of the problem has been solved, hemp no longer worry about my sad mood.


Related articles: