This commit is contained in:
awin-x 2024-12-05 13:34:13 +08:00
parent 19d5f9fa5b
commit 5a27235897
17 changed files with 206 additions and 79 deletions

View File

@ -0,0 +1,13 @@
<component name="ArtifactManager">
<artifact type="exploded-war" name="learn02:war exploded">
<output-path>$PROJECT_DIR$/out/artifacts/learn02_war_exploded</output-path>
<root id="root">
<element id="javaee-facet-resources" facet="learn02/web/Web" />
<element id="directory" name="WEB-INF">
<element id="directory" name="classes">
<element id="module-output" name="learn02" />
</element>
</element>
</root>
</artifact>
</component>

View File

@ -0,0 +1,20 @@
<component name="ArtifactManager">
<artifact type="exploded-war" name="learn02:war exploded2">
<output-path>$PROJECT_DIR$/out/artifacts/learn02_war_exploded2</output-path>
<root id="root">
<element id="directory" name="WEB-INF">
<element id="directory" name="classes">
<element id="module-output" name="learn02" />
</element>
<element id="directory" name="lib">
<element id="library" level="project" name="mysql-connector" />
<element id="library" level="project" name="sqlite-jdbc-3.47.0.0" />
<element id="library" level="project" name="commons-pool2-2.9.0" />
<element id="library" level="project" name="commons-logging-1.3.4" />
<element id="library" level="project" name="commons-dbcp2-2.9.0" />
</element>
</element>
<element id="javaee-facet-resources" facet="learn02/web/Web" />
</root>
</artifact>
</component>

View File

@ -3,6 +3,7 @@
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/homework02/homework02.iml" filepath="$PROJECT_DIR$/homework02/homework02.iml" />
<module fileurl="file://$PROJECT_DIR$/learn02/learn02.iml" filepath="$PROJECT_DIR$/learn02/learn02.iml" />
<module fileurl="file://$PROJECT_DIR$/learn1/learn1.iml" filepath="$PROJECT_DIR$/learn1/learn1.iml" />
<module fileurl="file://$PROJECT_DIR$/test02/test02.iml" filepath="$PROJECT_DIR$/test02/test02.iml" />
<module fileurl="file://$PROJECT_DIR$/test03/test03.iml" filepath="$PROJECT_DIR$/test03/test03.iml" />

23
learn02/learn02.iml Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="web" name="Web">
<configuration>
<descriptors>
<deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/web/WEB-INF/web.xml" />
</descriptors>
<webroots>
<root url="file://$MODULE_DIR$/web" relative="/" />
</webroots>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
version="6.0">
</web-app>

16
learn02/web/index.jsp Normal file
View File

@ -0,0 +1,16 @@
<%--
Created by IntelliJ IDEA.
User: awinx
Date: 2024/12/5
Time: ÏÂÎç1:31
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>$Title$</title>
</head>
<body>
$END$
</body>
</html>

View File

@ -18,17 +18,15 @@ public class UserLoginAction extends HttpServlet {
}
String username = req.getParameter("username");
String password = req.getParameter("password");
int flag;
UserInfo user = UserDB.GetUserInfoByName(username);
if(user == null) {
flag = 1;
response.sendRedirect(path+"/login/login.jsp&loginflag=1");
}else if (user.getPass().equals(password)) {
flag=0;
req.getSession().setAttribute("user", user);
response.sendRedirect(path+"/home.jsp");
}else{
flag=2;
response.sendRedirect(path+"/login/login.jsp&loginflag=2");
}
System.out.println(user);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.sendRedirect("error.jsp");

View File

@ -11,7 +11,8 @@
<head>
<meta charset="UTF-8">
<title>课程信息列表</title>
<link rel="stylesheet" href="../css/course.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/course.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/common.css">
</head>
<body>
<div class="container">

62
learn1/web/css/common.css Normal file
View File

@ -0,0 +1,62 @@
.container{
background-color: white;
position: relative;
margin: auto;
width: 80%;
}
body{
background-color: white;
}
a{
text-decoration: none;
color: white;
font-weight: bold;
}
table{
width:100%;
border-spacing: 0;
background-color: #c4c4c4;
}
tr{
height: 25px;
padding: 2px;
}
.tr-head{
background-color: #2bf;
text-align: center;
}
tr:nth-child(odd){
background:#F4F4F4;
}
button,.button{
background-color: #39f;
border: #39f solid 1px;
border-radius: 5px;
color: white;
padding: 5px;
line-height: 100%;
text-align: center;
margin: 5px;
}
.red {
COLOR: red
}
.blue {
color: blue;
}
.underline {
BORDER-BOTTOM: #c4c4c4 1pt solid;
BORDER-LEFT: #c4c4c4;
BORDER-RIGHT: #c4c4c4;
BORDER-TOP: #c4c4c4;
}

View File

@ -1,57 +1,3 @@
tr:nth-child(odd){
background:#F4F4F4;
}
.tr-head{
background-color: #2bf;
text-align: center;
}
table{
width:100%;
border-spacing: 0;
}
.td1 {
BACKGROUND-COLOR: #e6e6e6
}
.td_header {
BACKGROUND-COLOR: #e6e6e6; COLOR: #000000
}
.td_1 {
BACKGROUND-COLOR: #f8fbfb; COLOR: #000000
}
.td_2 {
BACKGROUND-COLOR: #deecec; COLOR: #000000
}
.td3 {
BACKGROUND-COLOR: #a3d1d2; COLOR: black
}
.underline {
BORDER-BOTTOM: #c4c4c4 1pt solid; BORDER-LEFT: #c4c4c4; BORDER-RIGHT: #c4c4c4; BORDER-TOP: #c4c4c4
}
.button {
border:1px solid black;
background-color:white;
cursor:hand;
}
.star {
COLOR: red
}
.tb_showall
{
background:#0078B7;
font-size: 18px;
font-weight: bold;
}
.container{
margin: auto;
width: 80%;
text-align: center;
align-items: center;
position: relative;
}
.input-form{
border: black solid 1px;
margin: auto;

View File

@ -1,4 +1,4 @@
.nav-list{
.nav-area{
position: absolute;
top: 0;
left: 0;
@ -8,13 +8,34 @@
margin: 0;
padding: 5px;
}
.nav-list{
padding-left: 0;
padding-right: 5px;
}
.nav-item{
list-style: none;
line-height: 100%;
text-align: center;
font-size: 19px;
margin: 5px 0;
padding: 3px 0;
color: white;
a{
text-decoration: none;
color: white;
font-weight: bold;
}
}
.content{
position: absolute;
top: 0;
right: 0;
background-color: #eee;
height: 95%;
width: 80%;
width: 79%;
margin: 0;
padding: 5px;
}

15
learn1/web/css/login.css Normal file
View File

@ -0,0 +1,15 @@
.login-card{
width: 80%;
border: #eee solid 2px;
border-radius: 5px;
}
input{
width: 75%;
height: 35px;
border: grey solid 2px;
border-radius: 5px;
margin: 5px;
padding: 5px;
line-height: 100%;
text-align: center;
}

View File

@ -9,15 +9,17 @@
<html>
<head>
<title>主页</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/common.css">
</head>
<body>
<div class="container">
<h1>学生信息管理系统</h1>
<%
if(session.getAttribute("user")==null){
out.println("<a href=\""+request.getContextPath()+"/login/login.jsp\">登录</a>");
out.println("<a href=\""+request.getContextPath()+"/login/login.jsp\"><button>登录</button></a>");
}else{
out.println("<a href=\""+request.getContextPath()+"/UserLogoutAction\">注销</a>");
out.println("<a href=\""+request.getContextPath()+"/UserLogoutAction\"><button>注销</button></a>");
}
%>
</div>

View File

@ -10,12 +10,13 @@
<head>
<title>学生信息管理系统</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/index.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/common.css">
</head>
<body>
<div class="nav-list">
<ul>
<li><a href="${pageContext.request.contextPath}/home.jsp" target="content">欢迎页</a></li>
<li><a href="${pageContext.request.contextPath}/course/course.jsp" target="content">课程列表</a></li>
<div class="nav-area">
<ul class="nav-list">
<li class="nav-item"><a href="${pageContext.request.contextPath}/home.jsp" target="content">欢迎页</a></li>
<li class="nav-item"><a href="${pageContext.request.contextPath}/course/course.jsp" target="content">课程列表</a></li>
</ul>
</div>
<iframe src="${pageContext.request.contextPath}/home.jsp" class="content" name="content" height="100%" width="100%"></iframe>

View File

@ -17,14 +17,14 @@ function getCourses(){
"<td>"+ data[i].credit +"</td>" +
"<td>"+ data[i].grade + "</td>" +
"<td>"+ majors[data[i].major]+"</td>" +
"<td><a href=\"#\" onclick=\"editCourse("+ i + ")\" " +
">编辑</a> <a href=\""+path+"/CourseDeleteAction?id=" +
"<td><a class='blue' onclick=\"editCourse("+ i + ")\" " +
">编辑</a> <a class='red' href=\""+path+"/CourseDeleteAction?id=" +
data[i].id+"\">删除</a></td>";
course_list.appendChild(course_tr);
}
const end_tr = document.createElement('tr');
end_tr.innerHTML="<td><a href=\"#\" onclick=\"addCourse()\">添加</a></td><td></td><td></td><td></td><td>" +
"<a href=\"#\" onclick=\"getCourses()\">刷新数据列表</a></td><td></td>";
end_tr.innerHTML="<td><a href=\"#\" class='blue' onclick=\"addCourse()\">添加</a></td><td></td><td></td><td></td><td>" +
"<a href=\"#\" class='blue' onclick=\"getCourses()\">刷新数据列表</a></td><td></td>";
course_list.appendChild(end_tr);
},
error: ()=>{

View File

@ -9,16 +9,18 @@
<html>
<head>
<title>登录</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/login.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/common.css">
</head>
<body>
<div class="login-card">
<h1>登录</h1>
<form action="${pageContext.request.contextPath}/UserLoginAction" method="POST">
<label for="username-input">用户名</label>
<input type="text" name="username" id="username-input">
<label for="password-input">密码</label>
<label for="username-input">用户名</label><br>
<input type="text" name="username" id="username-input"><br>
<label for="password-input">密码</label><br>
<input type="password" name="password" id="password-input">
<input type="submit" value="登录">
<input type="submit" class="button" value="登录">
</form>
</div>
</body>

View File

@ -28,8 +28,8 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Tomcat 10.1.31" level="application_server_libraries" />
<orderEntry type="library" name="lombok" level="project" />
<orderEntry type="library" name="sqlite-jdbc-3.47.0.0" level="project" />
<orderEntry type="library" exported="" name="Tomcat 10.1.31" level="application_server_libraries" />
<orderEntry type="library" exported="" name="lombok" level="project" />
<orderEntry type="library" exported="" name="sqlite-jdbc-3.47.0.0" level="project" />
</component>
</module>