JSP中文问题 数据库 读写解决方法

来源:互联网 发布:java 访问接口 编辑:程序博客网 时间:2024/04/29 04:59

 

1.写入数据库
String xxx=request.getParameter("xxx");
String xxxxx=new String(xxx.getBytes("ISO8859_1"),"GB2312");

 


2.从数据库中取出显示页面时

rs     //记录
String xxx=rs.getString(x);        //              x------索引
String xxxxx=new String(xxx.getBytes("GB2312"),"ISO8859_1");