<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'Zhuce.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<html>
<head><title>登录结果</title></head>
<body>
<%Class.forName("com.mysql.jdbc.Driver");
String url="jdbc:mysql://localhost:3306;DatabaseName=p";
String user="sa";
String password="123456";
String uid="";
String upwd="";
Connecting conn=DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement();
String userid=request.getParameter("userid");
String userpwd=request.getPrameter("userpwd");
String mysql=String.format("select * from userinfo where uid=%s",userid);
ResultSet rs=stmt.executeQuery(mysql);
if(rs.next()){
upwd=rs.getString("upwd");
if(upwd.equals(userpwd)){%>
<jsp:forward page=""/>
<%}
else{
out.print("密码错误");
}
}else{
out.print("用户不存在");
}%>
<br>
<a herf="Login.jsp">返回重新登录</a>
</body>
</html>