在JSP中如何实现MD5加密的方法(2)

<%@ page language='java' %> <jsp:useBean scope='request'/> <%@ page import='java.util.*'%> <%@ page import='java.sql.*'%> <html> <body> <% String userid = request.getParameter("UserID");//获取用户输入UserID String password = request.getParameter("Password"); //获取用户输入的Password String pwdmd5 = oMD5.getMD5ofStr(password);//计算MD5的值 PrintWriter rp = response.getWriter(); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:community", "", ""); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from users where userID ='"+userid+"' and pwdmd5= '" + pwdmd5+"'" ); if (rs.next()) { rp.print("Login OK"); } else { rp.print("Login Fail"); } stmt.close(); con.close(); %> </body> </html>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzggxd.html