目录
1.创建tomact环境与导入jar包
2.login.jsp 登录的页面
<%--
Created by IntelliJ IDEA.
User: zhuxiaoqiu
Date: 2021/6/15
Time: 20:20
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>登录界面</title>
</head>
<body>
<form action="/login" method="post">
用户名:<input type="text" name="uname"> <br>
密码:<input type="password" name="upwd"> <br>
<input type="submit" value="提交">
</form>
</body>
</html>
3.连接数据库
package com.zxq.util;
import com.mysql.jdbc.Driver;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DBTools {
static {
//1.判断数据库,建立驱动
try {
Driver driver = new Driver();
DriverManager.registerDriver(driver);
} catch (SQLException e) {
e.printStackTrace();
System.out.prin