如何在jsp中用中文

<%@ page language="java" import="java.io.*,java.sql.*,javax.sql.* ,javax.naming.*"%>
<%@ page contentType="text/html;charset=gb2312" %>
<HTML>
<TITLE>测试连接</TITLE>
</HEAD>
<body>
<P>
<FORM method=post name=form>
<input name="itemgroupid" type="text" id="itemgroupid">
<input type="submit" value="提交" name="submit </table>
</FORM>
<%
//数据库驱动名
String driverName="oracle.jdbc.driver.OracleDriver";
//数据库用户名
String userName="bill";
//密码
String userPasswd="bill";
//数据库名
String dbName="bill";
//连接字符串
String url="jdbc:oracle:thin:@localhost:1521:bill";
//结果
ResultSet rs = null;

String textContent=request.getParameter("itemgroupid");
%>
<%
try{
Class.forName(driverName);
Connection conn=DriverManager.getConnection(url,userName,userPasswd);
Statement stmt = conn.createStatement();
if (textContent == null) {
textContent = "";
out.println("输入的账目组为空");

}
else{
rs=stmt.executeQuery("SELECT b.name FROM a_Balance_Item_Group_Member a,acct_item_type b "+
" where a.acct_item_type_id=b.acct_item_type_id"+
" and a.item_group_id="+textContent);

while (rs.next())
{
out.println("该账目组成员有:" + rs.getObject(1) + "");
out.println(":"+"<br>");
}
rs.close();
}
}
catch(Exception e)
{out.println(e);
}
%>
</BODY>
</HTML>
================
目前这个代码是可以运行的,但是我想把item_group_id改成item_group_name
,改成item_group_name就报错
java.sql.SQLException: ORA-00911: invalid character
====请问,怎么才能不报错呢~

第1个回答  2009-07-31
楼上加的那句意思是:传递和接收参数时使用"GBK2312"编码,也就是简体中文
第2个回答  2009-07-30
加这句

<%request.setCharacterEncoding("GBK2312");%>本回答被提问者采纳
第3个回答  2009-07-30
没看出你是怎么个意思啊?