最近学院安排实验,涉及到用网页登录连接数据库登录验证,从网上搜寻资料,本文所写代码均为转载博客园夏小暑所写经验分享,但借鉴学习过程中并没有那么顺利,出现了解决不了的问题,大家帮帮忙啊
转载于https://www.cnblogs.com/xiaxiaoshu/p/6425918.html 夏小暑的文章
我的目录结构:
login:
<%@ page import="java.sql.*" language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>登录界面</title>
</head>
<body>
<center>
<h1 style="color:red">登录</h1>
<form id="indexform" name="indexForm" action="logincheck.jsp" method="post">
<table border="0">
<tr>
<td>账号:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="password" name="password">
</td>
</tr>
</table>
<br>
<input type="submit" value="登录" style="color:#BC8F8F">
</form>
</center>
</body>
</html>
logincheck:
<%@ page import="java.sql.*,java.util.*" language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/