jsp数据库中中文显示的问题?? out.println(rs1.getString("username"));不需要转换 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 out.println(rs1.getString("username").getBytes("ISO8859_1"));//这里显示几个问号这个地方不需要转换 你查看一下你的 access库里面的是不是乱码! 还有记得写上<%@page conentType="text/html;charset=gb2312"%> <%@page contentType="text/html;charset=gb2312"%>写错了。晕,我怎么象灌水的?! access里不是乱码?真的好奇怪。我在开头加了<meta http-equiv="Content-Type" content="text/html;charset=gb2312"> 谢谢 rainshow(要学习的那样多,时间却那么的少) 现在可以了难道 <meta http-equiv="Content-Type" content="text/html;charset=gb2312">跟<%@page contentType="text/html;charset=gb2312"%>不是一样的吗?能否解释一下 恩,再 bean里加上代码转化程序: public static String UnicodeToChinese(String s){ try { if(s==null||s.equals("")) return ""; String newstring=null; newstring=new String(s.getBytes("ISO8859_1"),"gb2312"); return newstring; } catch(Exception e) { return s; } } public static String ChineseToUnicode(String s){ try { if(s==null||s.equals("")) return ""; String newstring=null; newstring=new String(s.getBytes("gb2312"),"ISO8859_1"); return newstring; } catch(Exception e) { return s; } }然后再jsp调用 记住:要存入数据库的时候chinesetounicode,调用的时候再unicodetochinese 记住了!!谢谢ccccffff(长江流域) 非常有意思的一道题目。敢不敢试试。 struts2.0关于上传文件 的问题 tomcat部署项目问题 谁能告诉我,怎么用Jbuilder2006+tomcat5.5调试jsp。谢谢!行的话,90分全给他。 JSP页面之间传递参数的方法有哪些?? 关于论坛 请问哪里可以下载到tomcat5 ? 有人帮了我,我怎么给分啊,说我密码错误,不能给分 jsp连接数据库怎么不显示汉字?? 谈谈你对jdbc的理解? [讨论] 给 Tomcat 配 1G 的内存是否合适? 各位,今天遇到以下问题......(请帮忙)
<%@page conentType="text/html;charset=gb2312"%>
写错了。
晕,我怎么象灌水的?!
难道 <meta http-equiv="Content-Type" content="text/html;charset=gb2312">
跟
<%@page contentType="text/html;charset=gb2312"%>
不是一样的吗?
能否解释一下
public static String UnicodeToChinese(String s){
try
{
if(s==null||s.equals("")) return "";
String newstring=null;
newstring=new String(s.getBytes("ISO8859_1"),"gb2312");
return newstring;
}
catch(Exception e)
{
return s;
}
} public static String ChineseToUnicode(String s){
try
{
if(s==null||s.equals("")) return "";
String newstring=null;
newstring=new String(s.getBytes("gb2312"),"ISO8859_1");
return newstring;
}
catch(Exception e)
{
return s;
}
}
然后再jsp调用