Home  >  Article  >  Java  >  How to solve java servlet garbled characters

How to solve java servlet garbled characters

尚
Original
2019-11-21 17:04:182239browse

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);

2) Encode the forwarded content to be output

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

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!

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