WEB开发网
开发学院WEB开发Jsp 数据库乱码解决方案 阅读

数据库乱码解决方案

 2008-01-05 09:36:00 来源:WEB开发网   
核心提示:数据库乱码解决方案 你插入数据的时候,用 /** * 转变字符串的乱码函数 * @param str * @return */ public String getStr(String str) { try{ String temp_p = str; byte [] temp_t = temp_

  数据库乱码解决方案

你插入数据的时候,用
/**
* 转变字符串的乱码函数
* @param str
* @return
*/
public String getStr(String str)
{
try{
String temp_p = str;
byte [] temp_t = temp_p.getBytes("ISO8859-1");
String temp = new String(temp_t);
return temp;
}
catch(Exception e){
return "null";
}
}
//向bean里面赋值
public void setAction(String action) {
this.action = getStr(action);
}

public void setAddmanagerid(String addmanagerid) {
this.addmanagerid = getStr(addmanagerid);
}

转换一下,看看可以吗,我的数据库是Oracle没问题。

Tags:数据库 乱码 解决方案

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接