


I have been an intern in the company for 8 months, and I have always been working on android and h5. However, I found that I don’t know what to do when making programs or even a little service, so I recently started to learn java. I don’t know if it is because I have learned too much about frameworks. Now, it seems that the springmvc framework is much simpler than before. Here I am going to start learning from hibernate. After all, data is fundamental. First of all, I use hibernate+servlet, but when passing parameters from the jsp page to the servlet Chinese characters have been garbled. I tried many methods and finally solved it.
First, first check the encoding of the project and the encoding of the jsp page
Second, modify the server.xml file under tomcat
Third, configure the project filter
Fourth, modify the value-passing encoding and transfer encoding in the servlet
request.setCharacterEncoding("UTF-8");//value-passing encoding
response.setContentType("text /html;charset=UTF-8");//Set transfer encoding
五
String username=request.getParameter("username");
String username1=new String (username.getBytes("ISO-8859-1"),"utf-8");
Okay, I used the above four methods but failed to solve my problem. I used the fifth method. To solve the problem, I didn’t write down the detailed steps here. I just talked about the general modification method. You can Baidu for the detailed steps of the method. If nothing happens, it can be solved.
The solution to the problem of jsp passing parameters and servlet receiving Chinese garbled characters above is all the content shared by the editor. I hope it can give you a reference, and I also hope that everyone will support the PHP Chinese website.
For more jsp parameter-passing solutions to the problem of servlet receiving Chinese garbled characters, please pay attention to the PHP Chinese website for related articles!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver CS6
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
