如果是Eclipse的问题,那就对以下各项进行设置,即可排除问题。 设置eclipse相关编码为UTF-8: 修改工作区默认编码,位置:windows--perferences--general--workspace 修改JSP文件默认编码,位置:windows--perferences--web--jsp files 修改JSP文件默认编码,位置:windows--perferences--general--content types--text--jsp file 修改配置文件默认编码:位置:windows--perferences--general--content types--text--Java properties file 设置自动格式化代码:选中format source code--format all lines,位置:windows--perferences--Java--editor--save actions
如果是问题是在Hibernate读写数据时, 要对hibernate连接数据库的xml配置文件添加两项:
<property name="connection.useUnicode">true</property>
<property name="connection.characterEncoding">utf8</property>
转载于:https://www.cnblogs.com/Ryan-Leo/p/6224013.html
相关资源:JAVA上百实例源码以及开源项目