Solution
1. Add the coded character set after the local database address and name:
?useUnicode=true&characterEncoding=UTF-8
Complete as follows:
String url = "jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8";
2. Add the following statement to the JSP page:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%request.setCharacterEncoding("UTF-8");%>
<%response.setContentType("text/html;charset=utf-8");%>
<meta charset="UTF-8">