| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 685 人关注过本帖
标题:jsp 显示结果集 显示乱码(含源代码)
只看楼主 加入收藏
laoxie3
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2006-1-25
收藏
 问题点数:0 回复次数:0 
jsp 显示结果集 显示乱码(含源代码)

<!--
说明:数据库为oracle9i(字符集为英文),
jb2006中测试没有问题(通过字符转换后),jsp中无论如何做字符集转换也是乱码,请问这是什么原因。
-->
<%@ page contentType="text/html charset=gb2312" language="java" errorPage="" %>
<%@ page import="system.*" %>
<%@ page import="java.*" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.sql.*" %>
<%@ page import="java.sql.*" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE1 {color: #FF8040}
-->
</style>
</head>

<body>
<%
System_CfgFile cfgfile=new System_CfgFile();
System_DBConnBase dbconn=new System_DBConnBase();
System_SystemBase systembase = new System_SystemBase();
%>
<p class="STYLE1">数据库参数读取成功!</p>
<%
if (dbconn.dbConnection())
{%>
<p class="STYLE1">数据库直连成功!</p>
<%
}
if (!dbconn.dbConnection())
{
%>
<p class="STYLE1">数据库连接池连接成功!</p>
<p>
<%
}
String sqla=" select * from bm_bbdl";
ResultSet rs = dbconn.Execute_Query(sqla);
%>
<form id="form1" name="form1" method="post" action="">
<table border="2" bordercolor="#000033">
<tr>
<% int i = 0;
while (rs.next()) {

for (int column = 1; column < 3; column++) {
i++;
%>
<td> <%=("1:"+rs.getString(column))%> </td>
<td> <%=("2:"+rs.getString(column).getBytes())%> </td>
<td> <%=("3:"+rs.getString(column).getBytes("GB2312"))%> </td>
<td> <%=("4:"+rs.getString(column).getBytes("ISO8859_1"))%> </td>
<td> <%=("5:"+new String(rs.getString(column).getBytes()))%> </td>
<td> <%=("6:"+new String(rs.getString(column).getBytes(),"GB2312"))%> </td>
<td> <%=("7:"+new String(rs.getString(column).getBytes(),"ISO8859_1"))%> </td>
<td> <%=("8:"+new String(rs.getString(column).getBytes("GB2312")))%> </td>
<td> <%=("9:"+new String(rs.getString(column).getBytes("GB2312"),"GB2312"))%> </td>
<td> <%=("10:"+new String(rs.getString(column).getBytes("GB2312"),"ISO8859_1"))%> </td>
<td> <%=("11:"+new String(rs.getString(column).getBytes("ISO8859_1")))%> </td>
<td> <%=("12:"+new String(rs.getString(column).getBytes("ISO8859_1"),"GB2312"))%> </td>
<td> <%=("13:"+new String(rs.getString(column).getBytes("ISO8859_1"),"ISO8859_1"))%> </td>
<td> <%=("14:"+new String(rs.getString(column).getBytes("ISO8859_1"),"UTF8"))%> </td>

</tr>
<% }
}
%>

</table>
</form>

</body>
</html>
请高手指教,我已无招了。谢谢!

搜索更多相关主题的帖子: 源代码 jsp 乱码 结果 
2006-01-25 15:01
快速回复:jsp 显示结果集 显示乱码(含源代码)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.059054 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved