Home>Article>Java> What should I do if the return value of Java's ajax submission is Chinese garbled?

What should I do if the return value of Java's ajax submission is Chinese garbled?

coldplay.xixi
coldplay.xixi Original
2020-08-21 10:41:11 2073browse

Methods to solve the Chinese garbled return value of java's ajax submission: 1. Add code [products=text/html;charset=UTF-8] to the concurrent configuration of RequestMapping; 2. In the file [mvc: annotation-driven] Add code.

What should I do if the return value of Java's ajax submission is Chinese garbled?

[Related article recommendations:ajax video tutorial]

Solution to java's ajax submission return value in Chinese Methods for garbled characters:

1. It is determined (as a result of many tests) that Chinese garbled characters will only appear when the return value is String, and when the return value isMap06aeaed652f099bdd7b965333c229a74or other types, no Chinese garbled characters appear.

2. Add

products="text/html;charset=UTF-8"

to the concurrent configuration of @RequestMapping to solve the problem

3, or add

    text/html;charset=UTF-8 application/json;charset=UTF-8 */*;charset=UTF-8 

to mvc:annotation-driven in the configuration file. Related learning recommendations:java basic tutorial

The above is the detailed content of What should I do if the return value of Java's ajax submission is Chinese garbled?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to run java class file Next article:How to run java class file