After 8 months of internship in the company, I have been working on Android and H5, but I found out that I can't even have any services to do with the program, so I started to learn Java recently. I don't know if it's because I have learned too much framework. Now it seems that the springmvc framework is much simpler than before. Here I am planning to start learning from hibernate. After all, the data is fundamental. First of all, I use hibernate+servlet, but when I pass the jsp page to the servlet, Chinese is always garbled. I tried many methods, but finally solved it.
First,First, see the project encoding clearly, the jsp page encoding
second,Modify the file below tomcat
third,Project configuration filter
fourth,Modify the transmission value encoding and transmission encoding in the servlet
("UTF-8");//Transfer value encoding
("text/html;charset=UTF-8");//Set the transmission encoding
fifth
String username=("username");
String username1=new String(("ISO-8859-1"),"utf-8");
Okay, I used the above four but failed to solve my problem. I only used the fifth one. Here I did not write detailed steps, but just mentioned the general modification method. You can find the detailed steps of the method on Baidu. If nothing unexpected happens, you can solve it.
The above jsp transfer servlet to receive Chinese garbled code problem is all the content I share with you. I hope you can give you a reference and I hope you support me more.