满意答案
fvcxvb
2019.09.02
采纳率:45% 等级:9
已帮助:368人
login.JSP
注: 由于时间仓促,程序可能有细小的问题!但绝对可以满足你的需要了!如果你知道JSP什么原理;那么小的问题不是什么问题了! 共同学习~~~
欢迎光临企业办公平台
用户名: | |
密码: |
{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");Connection conn=DriverManager.getConnection("jdbc:odbc:a","root","database1");Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);ResultSet rs = null;String name =new String(request.getParameter(" UserName").getBytes(“8859_1”));String passwd =new String(request.getParameter(" UserPassword").getBytes(“8859_1”)); if(String_sql==null) { out.println("登陆名不可以为空"); out.println(“
”); }
else{
String_sql="select * from student where name ="+name+" and password="+psword+;
rs=stmt.executeQuery(String_sql)
while(rs.next())
{ out.println("登陆成功!");
out.println("您的用户名是:"+name)
out.println("您的密码是:"+password);
rs.close();
stmt.close();
conn.close();}
}
Catch( Exception e )
{out.println(“”); out.println(“出错了!”); out.println(“”);}%>
00分享举报