Home > Java > JavaBase > body text

How to solve java servlet garbled characters

Release: 2019-11-21 17:04:18
Original
2320 people have browsed it

How to solve java servlet garbled characters

Java Servlet is a program that runs on a Web server or application server. It serves as a link between a request from a Web browser or other HTTP client and a database or application on the HTTP server. middle layer.

Using Servlets, you can collect user input from web forms, render records from databases or other sources, and dynamically create web pages.

Servlet garbled solution:

1) Encode the received content (parameters)

request.setCharacterEncodeing(String charset);
Copy after login

2) Encode the forwarded content to be output

response.setContextType("text/html;charset=utf-8");
Copy after login

For more java knowledge, please pay attention to java basic tutorial.

The above is the detailed content of How to solve java servlet garbled characters. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template