环境配置tomcat9、jdk1.8(1.8以上版本会有报错,所以尽量1.8以下)jdbc驱动(我的是8.**),ecplise编译器
我直接在代码中注释吧! 新手上路,有说的不清楚的或者不正确的还请指出。
这里我只放了登录界面连接数据库并验证的代码,样式内的图片之类的我没放,成功跳转页面也没放出来
<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" %>
<%@ page import="com.mysql.jdbc.Driver" %>
<%@ page import="java.sql.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!-- 这是一个html5 doctype声明 -->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>用户登录</title>
</head>
<style type="text/css">
body{
margin:0px;
padding:0px;
overflow:hidden;
}
#wrapper{
position:absolute;
width:100%;
height:100%;
min-width:1280px;
min-height:680px;
overflow-x:hidden;
overflow-y:hidden;
background-image: -moz-linear-gradient(top,#77D1F6, #2F368F);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #77D1F6),color-stop(1, #2F368F));
}
#header{
height:100px;
width:100%;
}
#logo{
position:absolute;
float:left;
margin-left:5%;
margin-top:30px;
height:40px;
width:160px;
text-align:center;
}
#heading{
position:relative;
float:left;
margin-left:20%;
margin-top:-18px;
height:110px;
width:60%;
border-radius: 18px;
background-color:#1C75BC;
opacity:0.6;
}
#heading #title{
margin-top:40px;
text-align:center;
font-family:微软雅黑;
font-size:24px;
font-weight:bold;
}
#heading #subTitle{
margin-top:10px;
text-align:cent

本文介绍了使用JSP和MySQL搭建简单的登录验证界面的方法,涉及环境配置如Tomcat 9、JDK 1.8及jdbc驱动。代码中包含关键的数据库连接和验证逻辑,未展示完整样式和成功跳转页面的代码。

3662

被折叠的 条评论
为什么被折叠?



