Solve various garbled problems of Tomcat in IDEA


Solve various garbled problems of Tomcat in IDEA

1. Set the encoding format in IDEA

Insert image description here
Insert image description here

2.conf directory, open server.xml and modify it to UTF-8

Insert image description here

3.conf directory, open logging.properties, and change it to GBK to solve the problem of garbled console printing.

Insert image description here
Insert image description here

4.JSP garbled code

  1. If the JSP file is garbled, add it to the first line
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
  1. If the HTML file is garbled, add it to the head tag.
<meta charset="UTF-8">

5. Restart IDEA, reconfigure Tomcat, and start Tomcat

Guess you like

Origin blog.csdn.net/s17856147699/article/details/129009704