日期:2014-05-16 浏览次数:20412 次
查询状态的时候,数据库字段一般为数字,0或者1,0代表未读,1代表已读,页面需要显示已读或者未读,所以sql语句应该是:
?
?
select 
    a.name ,
    a.id,
    a.location ,
    case a.status 
        when 0 then 'YES' 
         else 'NO' end
    from 
        user as a
?
?
现在的问题是当? case a.status 
??????? when 0 then '已读' 
???????? else '未读' end
??? from 
??????? user as a
JSP页面中显示的字符为‘???’乱码
oracle中的字符集为 SIMPLIFIED CHINESE_CHINA.ZHS16GBK
jsp页面字符为UTF-8 <%@ page contentType="text/html;charset=UTF-8"%>
页面进行转码也貌似不行。
new String(status.getBytes("iso8859-1"), "utf-8");
所以这点要注意。
?