<解决一个小bug>
参考:https://blog.csdn.net/u011408270/article/details/51036916
初始情况介绍:
使用eclipse编程,初始设定字符集均为utf-8(教程:https://blog.csdn.net/qq_30507287/article/details/69055509),
mysql编码方式也为utf-8(查看mysql编码方式及修改:https://www.cnblogs.com/shootercheng/p/5836657.html),
但写入数据库时依然乱码
后来在Servlet中添加如下字段,就解决了乱码问题。
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
request.setCharacterEncoding("utf-8");
运行结果: