首先保证写到数据库中的是正确的
写之前用以下方法转换:
//package scs;
import java.io.*;
public class MyUtil
{
//
// 将GB2312码的字符串s转成Unicode码并返回
//
public static String gb2312ToUnicode(String s) {
try {
return new String(s.getBytes("ISO8859_1"), "GB2312");
}
catch (UnsupportedEncodingException uee) {
return s;
}
}//
// 将Unicode码的字符串s转成GB2312码并返回
//
public static String unicodeToGB2312(String s) {
try {
return new String(s.getBytes("GB2312"), "ISO8859_1");
}
catch (UnsupportedEncodingException uee) {
return s;
}
}}
显示的时候:jsp头:   <%@ page contentType="text/html; charset=gb2312" %>
就可以了