String s = new String(Recordset1.getString("info").getBytes("ISO8859_1"),"gb2312"); 可以从request得到中文
解决方案 »
- java 读取xml文件
- 整合apache和oc4j服务器
- <img src >图片的onmouseout和onmouseover事件源代码
- 问题:getClass().getResourceAsStream("/db.properties")是的db.properties在哪里?
- 大家测试一下我开发的多用户blog系统(java)
- 如何隐藏表格中的若干行?
- 通过Apache为什么不能直接执行Servlet,能解决问题者高分相送
- 小弟想学jsp,各位同仁能不能介绍好的教程
- 修改
- MultipartFile上传文件如何支持断点续传?
- 急啊~~~大虾推荐一下好的JSP开发方面的书啊~~
- 更新数据库问题
http://www.javayou.com (Java自由人)
这个也不行.
String s = new String(Recordset1.getString("info").getBytes("ISO8859_1"),"gb2312"); 可以从request得到中文
错误在http://seminar.eepw.com.cn/proload/show2.jsp
所以要指定编码,这就是getBytes("ISO8859_1")然后用于显示,所以要转换成gb2312
所以String s = new String(getParameter("xxxx").getBytes("ISO8859_1"),"gb2312");
见
http://seminar.eepw.com.cn/proload/show1.jsp
我想把已经存到数据库中的????转化出来,我用了转换,就是
http://seminar.eepw.com.cn/proload/show2.jsp
可是我的转化的这一步异常呢?我的show2.jsp代码如下
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="Connections/access.jsp" %>
<%
Driver DriverRecordset1 = (Driver)Class.forName(MM_access_DRIVER).newInstance();
Connection ConnRecordset1 = DriverManager.getConnection(MM_access_STRING,MM_access_USERNAME,MM_access_PASSWORD);
PreparedStatement StatementRecordset1 = ConnRecordset1.prepareStatement("SELECT * FROM embedded");
ResultSet Recordset1 = StatementRecordset1.executeQuery();
boolean Recordset1_isEmpty = !Recordset1.next();
boolean Recordset1_hasData = !Recordset1_isEmpty;
Object Recordset1_data;
int Recordset1_numRows = 0;
%>
<%
int Repeat1__numRows = 50;
int Repeat1__index = 0;
Recordset1_numRows += Repeat1__numRows;
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body>
<table border="1">
<tr>
<td>info</td>
</tr>
<% while ((Recordset1_hasData)&&(Repeat1__numRows-- != 0)) { %>
<tr>
<td><%=(((Recordset1_data = Recordset1.getObject("info"))==null || Recordset1.wasNull())?"":Recordset1_data)%>
<%
// response.setContentType("text/html;charset=gb2312");
try{
String s = new String(Recordset1.getObject("info").getBytes("ISO8859_1"),"gb2312");
// s = new String(Recordset1_data.getBytes("GB2312"));
}catch(Exception e){}
out.println(s);
%></td> </tr>
<%
Repeat1__index++;
Recordset1_hasData = Recordset1.next();
}
%>
</table>
</body>
</html>
<%
Recordset1.close();
StatementRecordset1.close();
ConnRecordset1.close();
%>