1、重新安裝eclipse,未設置編碼問題,導致亂碼
2、編碼設置可以在新建項目時設置,也可以在workspace中設置
3、servlet中未設置編碼格式,導致的亂碼
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
4、jdbc連接中的亂碼問題
public String JDBC_URL = "jdbc:mysql://localhost:3306/mi_shop_store?characterEncoding=UTF-8";
此時需要加上true&
public String JDBC_URL = "jdbc:mysql://localhost:3306/mi_shop_store?true&characterEncoding=UTF-8";