为什么数据库能连上,但是不能取出数据,麻烦了!
建立了一个数据库mydb,再建表username,写入一个数据tanglei,数据类型为varchar,列名为user_name,然后编一个用户登陆的login.JSP,<form action="main.jsp" method="POST">
<p> 用户名:
<input type="text" size="10" name="user_name"/>
</form>
再编一个main.jsp,用
String username=request.getParameter("user_name");
if(username==null){username="";}
byte a[] =username.getBytes("ISO-8859-1");
username=new String(a);
然后连接数据库也正常,用String t=rs.getString("user_name");然后用out,print(t)也可以显示,再写if(username==t){out.print("OK!");}else{out.print("false!")}
运行程序,在login.jsp中输入tanglei提交,但是mian.jsp中总是显示false,实在不懂,麻烦了!!谢谢!