`
tianke66
  • 浏览: 183911 次
  • 性别: Icon_minigender_1
  • 来自: 西安
文章分类
社区版块
存档分类
最新评论

java乱码问题

阅读更多

这两天在用Struts 1.2+hibernate3.0+spring1.2+mysql5.0.19做个小系统,遇到乱码问题。
以下是在网络上找到的解决办法
在连接mysql数据库时,url的写法
jdbc:mysql://localhost:3306/testdb?useUnicode=true&characterEncoding=gbk
此时要注意:如果我是把这个url写在JAVA代码或properties中,就直接这样写。但如果是在xml配置文件中
(如struts-config.xml,web.xml,applicationContext.xml等),要把其中的&改为&才行,否则会出错。也就是:
jdbc:mysql://localhost:3306/testdb?useUnicode=true&characterEncoding=gbk

两个解决乱码的网址:
tomcat下中文的彻底解决:http://www.javaresearch.org/article/showarticle.jsp?column=106&thread=19240
Mysql与JSP网页中文乱码问题的解决方案:http://www.daima.com.cn/Info/121/Info37107/

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics