目錄
前言
一、搭建環(huán)境
?二、功能實現(xiàn)、
1、? ?登陸界面
注冊按鈕
2、學(xué)生信息管理系統(tǒng)主界面
3、dao包
?4、用戶的信息展示,添加,刪除,修改功能(只展示添加代碼)
5、學(xué)生的信息展示,添加,刪除,修改功能(只展示添加代碼)
6、成績的信息展示,添加,刪除,修改功能(只展示添加代碼)
7、公告欄的信息展示,添加,刪除,修改功能(只展示添加代碼)
三、效果圖展示
登錄界面
?登錄成功后主界面
?學(xué)生信息管理界面
?學(xué)生成績信息管理界面
公告欄界面
個人中心界面
?四、總結(jié)
前言
? ? ? ?本人是計算機(jī)相關(guān)專業(yè)的一個學(xué)生,大一學(xué)了Java,熟悉了一些Java代碼,覺得挺有意思便在網(wǎng)上自學(xué)了一點基礎(chǔ)的Servlet和前端頁面的制作,正好實訓(xùn)周的實訓(xùn)項目是寫一個學(xué)生管理系統(tǒng),便琢磨了這樣一套代碼。
? ? ? ?學(xué)生信息管理系統(tǒng)是為了方便老師查看學(xué)生信息,成績信息等等的平臺,所以我們的代碼實現(xiàn)出來的效果必須要很清楚明了地展現(xiàn)這些功能。此學(xué)生系統(tǒng)有登錄過程,所以可能會比一般的代碼多,話不多說,來吧,展示!
一、搭建環(huán)境
1、使用的開發(fā)工具是eclipse,在工程文件下建一個新的model模塊“student”,然后在“student”下建以下包用來分類代碼,下面那些JSP文件寫的都是一些關(guān)于頁面制作和運行邏輯的代碼。整個系統(tǒng)肯定是不止這些JSP文件的,因為要連接MYSQL,所以還會有DAO包,這里只是部分JSP文件展示了出來,后面會有部分代碼的展示。
?2、我們所有的信息數(shù)據(jù)是在navicat里的,通過建表,填充數(shù)據(jù),然后代碼調(diào)用來實現(xiàn)查詢,添加等功能的:
?二、功能實現(xiàn)
本系統(tǒng)代碼非常多,所以文章內(nèi)只作部分代碼的展示,見諒......
1、登陸界面
這里面寫了一些關(guān)于賬號密碼的驗證,賬號密碼信息來自于navicat里面所創(chuàng)的表
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<html>
<head>
<title>登錄</title>
<link rel="stylesheet" href="js/myCss.css">
<script src="js/jquery.min.js"></script>
<script src="js/myJs.js"></script>
<script type="text/javascript">
let alert_msg = '${alert_msg}';
if (alert_msg != null && alert_msg.trim() != '') {
window.alert(alert_msg);
}
</script>
</head>
<body>
<div class="bg"></div>
<div class="container">
<div class="line bouncein">
<div class="xs6 xm4 xs3-move xm4-move">
<div style="height:150px;"></div>
<div class="media media-y margin-big-bottom">
</div>
<form action="AuthServlet?action=login" method="post" onsubmit="return check()">
<div class="panel loginbox">
<div class="text-center margin-big padding-big-top" style="font-size: 35px;font-weight: 700;color:#000000;text-shadow: 2px 3px #FFFFFF;">重慶**大學(xué)學(xué)生信息管理系統(tǒng)</div>
<a style="font-size: 24px;color: #269abc;text-decoration: none;padding-left: 140px;">登錄</a>       <a href="register.jsp" style="font-size: 24px;color:black ;text-decoration: none;">注冊</a>
<div class="panel-body" style="padding:30px; padding-bottom:10px; padding-top:10px;">
<div class="form-group">
<div class="field field-icon-right">
<input type="text" class="input input-big" name="username" id="username" placeholder="登錄賬號" />
<span class="icon icon-user margin-small"></span>
</div>
</div>
<div class="form-group">
<div class="field field-icon-right">
<input type="password" class="input input-big" name="password" id="password" placeholder="登錄密碼" />
<span class="icon icon-key margin-small"></span>
</div>
</div>
<div class="form-group">
<div class="field field-icon-right">
<input type="text" class="input input-big" name="validationCode" id="validationCode" placeholder="請輸入驗證碼" style="width: 180px;float: left;"/>
<img id="img_validation_code" src="AuthServlet?action=validationCode" onclick="refresh()" style="height: 44px;width: 150px;float: right;border-radius: 4px;"/>
</div>
</div>
</div>
<br><br>
<div style="padding:30px;">
<input type="submit" class="button button-block bg-main text-big input-big" value="登錄">
</div>
</div>
</form>
</div>
</div>
</div>
</body>
<script type="text/javascript">
//提交之前進(jìn)行檢查,如果return false,則不允許提交
function check() {
//根據(jù)ID獲取值
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
if (username == "") {
alert("用戶名不能為空");
return false;
}
if (password == "") {
alert("密碼不能為空");
return false;
}
return true;
}
function refresh() {
var img = document.getElementById("img_validation_code")
img.src = "AuthServlet?action=validationCode&r=" + Math.random();
}
</script>
</html>
注冊按鈕
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<html>
<head>
<title>注冊</title>
<link rel="stylesheet" href="js/myCss.css">
<script src="js/jquery.min.js"></script>
<script src="js/myJs.js"></script>
<script type="text/javascript">
let alert_msg = '${alert_msg}';
if (alert_msg != null && alert_msg.trim() != '') {
window.alert(alert_msg);
}
</script>
</head>
<body>
<div class="bg"></div>
<div class="container">
<div class="line bouncein">
<div class="xs6 xm4 xs3-move xm4-move">
<div style="height:150px;"></div>
<div class="media media-y margin-big-bottom">
</div>
<form action="AuthServlet?action=register" method="post" onsubmit="return check()">
<input type="hidden" name="forwardPage" id="forwardPage" value="menu.jsp"/>
<div class="panel loginbox">
<div class="text-center margin-big padding-big-top" style="font-size: 35px;font-weight: 700;color:#000000;text-shadow: 2px 3px #FFFFFF;">學(xué)生信息管理系統(tǒng)</div>
<a href="login.jsp" style="font-size: 24px;color: black;text-decoration: none;padding-left: 140px;">登錄</a>       <a style="font-size: 24px;color:#269abc ;text-decoration: none;">注冊</a>
<div class="panel-body" style="padding:30px; padding-bottom:10px; padding-top:10px;">
<div class="form-group">
<div class="field field-icon-right">
<input type="text" class="input input-big" name="username" id="username" placeholder="登錄賬號"/>
<span class="icon icon-user margin-small"></span>
</div>
</div>
<div class="form-group">
<div class="field field-icon-right">
<input type="password" class="input input-big" name="password" id="password" placeholder="登錄密碼"/>
<span class="icon icon-key margin-small"></span>
</div>
</div>
<div class="form-group">
<div class="field field-icon-right">
<input type="password" class="input input-big" name="password2" id="password2" placeholder="確認(rèn)密碼"/>
<span class="icon icon-key margin-small"></span>
</div>
</div>
</div>
<div style="padding:30px;">
<input type="submit" class="button button-block bg-main text-big input-big" value="注冊">
</div>
</div>
</form>
</div>
</div>
</div>
</body>
<script type="text/javascript">
//提交之前進(jìn)行檢查,如果return false,則不允許提交
function check() {
//根據(jù)ID獲取值
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
var password2 = document.getElementById("password2").value;
if (username == "") {
alert("用戶名不能為空!");
return false;
}
if (password == "") {
alert("密碼不能為空!");
return false;
}
if (password2 != password) {
alert("密碼輸入不一致!");
return false;
}
return true;
}
</script>
</html>
2、學(xué)生信息管理系統(tǒng)主界面
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="renderer" content="webkit">
<title>學(xué)生信息管理系統(tǒng)</title>
<link rel="stylesheet" href="js/myCss.css">
<script src="js/jquery.min.js"></script>
</head>
<body style="background-color:#f2f9fd;">
<div class="header bg-main">
<div class="logo margin-big-left fadein-top">
<h1 style="text-shadow: 1px 2px #FFFFFF;color: #000000"><%--<img src="img/icon.jpg" class="radius-circle rotate-hover" height="50" alt=""/>--%>重慶**大學(xué)學(xué)生信息管理系統(tǒng)</h1>
</div>
<div class="head-l" style="float: right;margin-right: 100px;"><a class="button button-little bg-red" href="AuthServlet?action=logout"><span class="icon-power-off"></span>退出</a></div>
</div>
<div class="leftnav">
<div class="leftnav-title"><strong><span class="icon-list"></span>菜單列表</strong></div>
<h2><span class="icon-user"></span>個人中心</h2>
<ul>
<li><a href="reset_password.jsp" target="right"><span class="icon-caret-right"></span>密碼修改</a></li>
</ul>
<h2><span class="icon-user"></span>系統(tǒng)管理</h2>
<ul>
<li><a href="UserServlet" target="right"><span class="icon-caret-right"></span>用戶管理</a></li>
<li><a href="StudentServlet" target="right"><span class="icon-caret-right"></span>學(xué)生信息管理</a></li>
<li><a href="ScoreServlet" target="right"><span class="icon-caret-right"></span>成績信息管理</a></li>
<li><a href="NoticeServlet" target="right"><span class="icon-caret-right"></span>學(xué)校公告墻</a></li>
</ul>
</div>
<script type="text/javascript">
$(function () {
$(".leftnav h2").click(function () {
$(this).next().slideToggle(200);
$(this).toggleClass("on");
});
$(".leftnav ul li a").click(function () {
$("#a_leader_txt").text($(this).text());
$(".leftnav ul li a").removeClass("on");
$(this).addClass("on");
});
$('.leftnav ul').css('display','block');
});
</script>
<ul class="bread">
<li><a href="UserServlet?action=list" target="right" class="icon-home">首頁</a></li>
<li><a id="a_leader_txt">用戶管理</a></li>
</ul>
<div class="admin">
<iframe scrolling="auto" rameborder="0" src="UserServlet?action=list" name="right" width="100%" height="100%"></iframe>
</div>
</body>
</html>
3、dao包等
(1)包com.demo.dao
①公告模塊的DAO層(數(shù)據(jù)層)接口,提供增刪改查等數(shù)據(jù)庫操作的方法抽象
package com.demo.dao;
import com.demo.vo.Notice;
import java.io.Serializable;
import java.util.Map;
public interface NoticeDAO {
/**
* 增加公告表記錄
*
* @param vo
* @return
*/
void add(Notice vo);
/**
* 根據(jù)主鍵id,刪除對應(yīng)的公告表記錄
*
* @param id
* @return
*/
boolean delete(long id);
/**
* 更新公告表記錄
*
* @param vo
* @return
*/
void update(Notice vo);
/**
* 根據(jù)主鍵id獲取公告表記錄的詳情
*
* @param id
* @return
*/
Notice get(Serializable id);
/**
* 根據(jù)條件查詢公告的列表與數(shù)量
*
* @param params
* @return
*/
Map<String, Object> list(Map<String, Object> params);
}
②成績信息模塊的DAO層(數(shù)據(jù)層)接口,提供增刪改查等數(shù)據(jù)庫操作的方法抽象
package com.demo.dao;
import com.demo.vo.Score;
import java.io.Serializable;
import java.util.Map;
public interface ScoreDAO {
/**
* 增加成績信息表記錄
*
* @param vo
* @return
*/
void add(Score vo);
/**
* 根據(jù)主鍵id,刪除對應(yīng)的成績信息表記錄
*
* @param id
* @return
*/
boolean delete(long id);
/**
* 更新成績信息表記錄
*
* @param vo
* @return
*/
void update(Score vo);
/**
* 根據(jù)主鍵id獲取成績信息表記錄的詳情
*
* @param id
* @return
*/
Score get(Serializable id);
/**
* 根據(jù)條件查詢成績信息的列表與數(shù)量
*
* @param params
* @return
*/
Map<String, Object> list(Map<String, Object> params);
}
③學(xué)生信息模塊的DAO層(數(shù)據(jù)層)接口,提供增刪改查等數(shù)據(jù)庫操作的方法抽象
package com.demo.dao;
import com.demo.vo.Student;
import java.io.Serializable;
import java.util.Map;
public interface StudentDAO {
/**
* 增加學(xué)生信息表記錄
*
* @param vo
* @return
*/
void add(Student vo);
/**
* 根據(jù)主鍵id,刪除對應(yīng)的學(xué)生信息表記錄
*
* @param id
* @return
*/
boolean delete(long id);
/**
* 更新學(xué)生信息表記錄
*
* @param vo
* @return
*/
void update(Student vo);
/**
* 根據(jù)主鍵id獲取學(xué)生信息表記錄的詳情
*
* @param id
* @return
*/
Student get(Serializable id);
/**
* 根據(jù)條件查詢學(xué)生信息的列表與數(shù)量
*
* @param params
* @return
*/
Map<String, Object> list(Map<String, Object> params);
}
④用戶模塊的DAO層(數(shù)據(jù)層)接口,提供增刪改查等數(shù)據(jù)庫操作的方法抽象
package com.demo.dao;
import com.demo.vo.User;
import java.io.Serializable;
import java.util.Map;
public interface UserDAO {
/**
* 增加用戶表記錄
*
* @param vo
* @return
*/
void add(User vo);
/**
* 根據(jù)主鍵id,刪除對應(yīng)的用戶表記錄
*
* @param id
* @return
*/
boolean delete(long id);
/**
* 更新用戶表記錄
*
* @param vo
* @return
*/
void update(User vo);
/**
* 根據(jù)主鍵id獲取用戶表記錄的詳情
*
* @param id
* @return
*/
User get(Serializable id);
/**
* 根據(jù)條件查詢用戶的列表與數(shù)量
*
* @param params
* @return
*/
Map<String, Object> list(Map<String, Object> params);
}
(2)包com.demo.dao.impl
? ? ? ? 公告模塊、成績信息模塊、學(xué)生信息模塊以及用戶模塊的DAO層(數(shù)據(jù)層)的具體實現(xiàn)類,分別對NoticeDAO、ScoreDAO、StudentDAO、UserDAO接口中定義的增刪改查等抽象方法作出具體的功能實現(xiàn)(下面僅展示了公告模塊得DAO層得具體實現(xiàn)類代碼)
package com.demo.dao.impl;
import com.demo.util.Util;
import com.demo.dao.NoticeDAO;
import com.demo.vo.Notice;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class NoticeDAOImpl implements NoticeDAO {
//@Override
public void add(Notice vo) {
String sql = "insert into `t_notice` (`notice_name`,`notice_text`,`notice_type`,`create_date`) values(?,?,?,?)";
try {
Connection c = Util.getConnection();
PreparedStatement ps = c.prepareStatement(sql);
ps.setString(1, vo.getNoticeName());
ps.setString(2, vo.getNoticeText());
ps.setString(3, vo.getNoticeType());
ps.setString(4, vo.getCreateDate());
ps.execute();
ps.close();
c.close();
} catch (Exception e) {
e.printStackTrace();
}
}
//@Override
public void update(Notice vo) {
String sql = "update `t_notice` set `notice_name` = ? ,`notice_text` = ? ,`notice_type` = ? ,`create_date` = ? where `id` = ?";
try {
Connection c = Util.getConnection();
PreparedStatement ps = c.prepareStatement(sql);
ps.setString(1, vo.getNoticeName());
ps.setString(2, vo.getNoticeText());
ps.setString(3, vo.getNoticeType());
ps.setString(4, vo.getCreateDate());
ps.setLong(5, vo.getId());
ps.execute();
ps.close();
c.close();
} catch (Exception e) {
e.printStackTrace();
}
}
//@Override
public boolean delete(long id) {
try {
Connection c = Util.getConnection();
Statement s = c.createStatement();
String sql = "delete from `t_notice` where id = " + id;
s.execute(sql);
s.close();
c.close();
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
//@Override
public Notice get(Serializable id) {
Notice vo = null;
try {
Connection c = Util.getConnection();
Statement s = c.createStatement();
String sql = "select * from `t_notice` where id = " + id;
ResultSet rs = s.executeQuery(sql);
if (rs.next()) {
vo = new Notice();
vo.setId(rs.getLong("id"));
vo.setNoticeName(rs.getString("notice_name"));
vo.setNoticeText(rs.getString("notice_text"));
vo.setNoticeType(rs.getString("notice_type"));
vo.setCreateDate(rs.getString("create_date"));
}
c.close();
} catch (Exception e) {
e.printStackTrace();
}
return vo;
}
//@Override
public Map<String, Object> list(Map<String, Object> params) {
List<Notice> list = new ArrayList();
int totalCount = 0;
String condition = "";
String sqlList;
if (params.get("searchColumn") != null && !"".equals(params.get("searchColumn"))) {
condition += " and `" + params.get("searchColumn") + "` like '%" + params.get("keyword") + "%'";
}
try {
Connection c = Util.getConnection();
PreparedStatement ps;
ResultSet rs;
String limit = (params.get("startIndex") != null && params.get("pageSize") != null) ? " limit " + params.get("startIndex") + "," + params.get("pageSize") : "";
sqlList = "select * from `t_notice` where 1=1 " + condition + " order by id asc " + limit + ";";
ps = c.prepareStatement(sqlList);
rs = ps.executeQuery();
while (rs.next()) {
Notice vo = new Notice();
vo.setId(rs.getLong("id"));
vo.setNoticeName(rs.getString("notice_name"));
vo.setNoticeText(rs.getString("notice_text"));
vo.setNoticeType(rs.getString("notice_type"));
vo.setCreateDate(rs.getString("create_date"));
list.add(vo);
}
String sqlCount = "select count(*) from `t_notice` where 1=1 " + condition;
ps = c.prepareStatement(sqlCount);
rs = ps.executeQuery();
if (rs.next()) {
totalCount = rs.getInt(1);
}
rs.close();
ps.close();
c.close();
} catch (Exception e) {
e.printStackTrace();
}
Map<String, Object> result = new HashMap();
result.put("list", list);
result.put("totalCount", totalCount);
return result;
}
}
(3)包com.demo.service
? ? ? ?公告模塊、成績信息模塊、學(xué)生信息模塊以及用戶模塊的Service層(業(yè)務(wù)層)接口,提供業(yè)務(wù)方法的抽象(這里只展示了公告模塊的Service層(業(yè)務(wù)層)接口代碼)
package com.demo.service;
import com.demo.vo.Notice;
import java.io.Serializable;
import java.util.Map;
public interface NoticeService {
/**
* 增加公告
*
* @param vo
* @return
*/
void add(Notice vo);
/**
* 刪除公告
*
* @param id
* @return
*/
void delete(long id);
/**
* 修改公告
*
* @param vo
* @return
*/
void update(Notice vo);
/**
* 根據(jù)主鍵Id查詢公告詳情
*
* @param id
* @return
*/
Notice get(Serializable id);
/**
* 根據(jù)條件查詢公告的列表與數(shù)量
*
* @param params
* @return
*/
Map<String, Object> list(Map<String, Object> params);
}
(4)包com.demo.service.impl
? ? ? ?公告模塊、成績信息模塊、學(xué)生信息模塊以及用戶模塊的Service層(業(yè)務(wù)層)的具體實現(xiàn)類,分別對NoticeService、ScoreService、StudentService、UserService接口中定義的抽象方法作出具體的功能實現(xiàn)(這里只展示了公告模塊的Service層(業(yè)務(wù)層)的具體實現(xiàn)類的代碼)
package com.demo.service.impl;
import com.demo.dao.NoticeDAO;
import com.demo.dao.impl.NoticeDAOImpl;
import com.demo.service.NoticeService;
import com.demo.vo.Notice;
import java.io.Serializable;
import java.util.Map;
public class NoticeServiceImpl implements NoticeService {
//@Override
public void add(Notice vo) {
NoticeDAO noticeDAO = new NoticeDAOImpl();
noticeDAO.add(vo);
}
//@Override
public void delete(long id) {
NoticeDAO noticeDAO = new NoticeDAOImpl();
noticeDAO.delete(id);
}
//@Override
public void update(Notice vo) {
NoticeDAO noticeDAO = new NoticeDAOImpl();
noticeDAO.update(vo);
}
//@Override
public Notice get(Serializable id) {
NoticeDAO noticeDAO = new NoticeDAOImpl();
return noticeDAO.get(id);
}
//@Override
public Map<String, Object> list(Map<String, Object> params) {
NoticeDAO noticeDAO = new NoticeDAOImpl();
return noticeDAO.list(params);
}
}
(5)包com.demo.util
①? LoginFilter.java
? ? ?這是過濾器
? ? ?主要負(fù)責(zé)過濾編碼為utf-8及登錄攔截,禁止未登錄就訪問
package com.demo.util;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
public class LoginFilter implements Filter {
//@Override
public void destroy() {
}
//@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
HttpSession session = request.getSession();
//過濾編碼
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
//移除錯誤提示
session.removeAttribute("alert_msg");
//登錄攔截
String uri = request.getRequestURI();
String action = request.getParameter("action");
if (uri.endsWith("login.jsp") || uri.endsWith("register.jsp") || "register".equalsIgnoreCase(action) || "validationCode".equalsIgnoreCase(action) || "login".equalsIgnoreCase(action) || uri.contains("/include/") || uri.contains("/img/") || uri.contains("/js/")) {
chain.doFilter(request, response);
return;
} else if (session.getAttribute("loginUser") == null) {
session.setAttribute("alert_msg", "錯誤:請先登錄!");
response.sendRedirect("login.jsp");
return;
}
chain.doFilter(request, response);
}
//@Override
public void init(FilterConfig arg0) throws ServletException {
}
}
②? ?PageBean.java
? ? ? 列表頁面的顯示對象
package com.demo.util;
import java.util.List;
public class PageBean<T> {
private List<T> list;//根據(jù)條件查詢出來的list集合
private int totalRecord;//根據(jù)條件查詢出來的數(shù)量
public List<T> getList() {
return list;
}
public void setList(List<T> list) {
this.list = list;
}
public int getTotalRecord() {
return totalRecord;
}
public void setTotalRecord(int totalRecord) {
this.totalRecord = totalRecord;
}
//--分頁邏輯
//已知數(shù)據(jù)
private int pageNum;//當(dāng)前頁,從請求那邊傳過來。
private int pageSize;//每頁顯示的數(shù)據(jù)條數(shù)。
//需要計算得來
private int totalPage; //總頁數(shù),通過totalRecord和pageSize計算可以得來
//開始索引,也就是我們在數(shù)據(jù)庫中要從第幾行數(shù)據(jù)開始拿,有了startIndex和pageSize,
//就知道了limit語句的兩個數(shù)據(jù),就能獲得每頁需要顯示的數(shù)據(jù)了
private int startIndex;
//分頁顯示的頁數(shù),比如在頁面上顯示1,2,3,4,5頁,start就為1,end就為5,這個也是算過來的
private int start;
private int end;
private String servlet;//查詢時要請求的接口
private String searchColumn;//待模糊查詢的列
private String keyword;//待模糊查詢的關(guān)鍵字
//通過pageNum,pageSize,totalRecord計算得來tatalPage和startIndex,構(gòu)造方法中將pageNum,pageSize,totalRecord獲得
public PageBean(int pageNum, int totalRecord) {
this.pageNum = (pageNum = Math.max(pageNum, 1));
this.pageSize = 10;//默認(rèn)為10
this.totalRecord = totalRecord;
//totalPage 總頁數(shù)
if (totalRecord % pageSize == 0) {
//說明整除,正好每頁顯示pageSize條數(shù)據(jù),沒有多余一頁要顯示少于pageSize條數(shù)據(jù)的
this.totalPage = totalRecord / pageSize;
} else {
//不整除,就要在加一頁,來顯示多余的數(shù)據(jù)。
this.totalPage = totalRecord / pageSize + 1;
}
//開始索引
this.startIndex = (pageNum - 1) * pageSize;
//顯示5頁,這里自己可以設(shè)置,想顯示幾頁就自己通過下面算法修改
this.start = 1;
this.end = 5;
//顯示頁數(shù)的算法
if (totalPage <= 5) {
//總頁數(shù)都小于5,那么end就為總頁數(shù)的值了。
this.end = this.totalPage;
} else {
//總頁數(shù)大于5,那么就要根據(jù)當(dāng)前是第幾頁,來判斷start和end為多少了,
this.start = pageNum - 2;
this.end = pageNum + 2;
if (start < 0) {
//比如當(dāng)前頁是第1頁,或者第2頁,那么就不如和這個規(guī)則,
this.start = 1;
this.end = 5;
}
if (end > this.totalPage) {
//比如當(dāng)前頁是倒數(shù)第2頁或者最后一頁,也同樣不符合上面這個規(guī)則
this.end = totalPage;
this.start = end - 5;
}
}
}
//get、set方法。
public int getPageNum() {
return pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getStartIndex() {
return startIndex;
}
public void setStartIndex(int startIndex) {
this.startIndex = startIndex;
}
public int getStart() {
return start;
}
public void setStart(int start) {
this.start = start;
}
public int getEnd() {
return end;
}
public void setEnd(int end) {
this.end = end;
}
public String getServlet() {
return servlet;
}
public void setServlet(String servlet) {
this.servlet = servlet;
}
public String getSearchColumn() {
return searchColumn;
}
public void setSearchColumn(String searchColumn) {
this.searchColumn = searchColumn;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
}
③? Util.java
? ? ?該方法為通用的工具類,放置一些共用的方法
package com.demo.util;
import java.sql.Connection;
import java.sql.DriverManager;
import java.text.SimpleDateFormat;
public class Util {
public static String DBDRIVER = "com.mysql.jdbc.Driver";
public static String DBURL = "jdbc:mysql://localhost:3306/student?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true&failOverReadOnly=false&allowPublicKeyRetrieval=true";
public static String DBUSER = "root";
public static String PASSWORD = "1008611xqr";
/**
* 取得數(shù)據(jù)庫連接對象
*
* @return 如果連接成功則返回連接對象,如果連接失敗返回null
*/
public static Connection getConnection() throws Exception {
Class.forName(DBDRIVER);
return DriverManager.getConnection(DBURL, DBUSER, PASSWORD);
}
/**
* 測試連接是否成功
*
* @param args
* @throws Exception
*/
public static void main(String[] args) {
try {
Connection conn = Util.getConnection();
System.out.println("數(shù)據(jù)庫連接成功!??!");
conn.close();
} catch (Exception e) {
e.printStackTrace();
System.out.println("數(shù)據(jù)庫連接失?。。。?);
}
}
/**
* 獲取系統(tǒng)當(dāng)前時間并格式化為字符串
*
* @return
*/
public static String getTime() {
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(System.currentTimeMillis());
}
/**
* 判斷字符串是不是中文
*
* @param c
* @return
*/
private static boolean isChinese(char c) {
Character.UnicodeBlock ub = Character.UnicodeBlock.of(c);
return (ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
|| ub == Character.UnicodeBlock.GENERAL_PUNCTUATION
|| ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION
|| ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS);
}
/**
* 判斷字符串是否是亂碼
*
* @param strName
* @return
*/
public static boolean isMessyCode(String strName) {
java.util.regex.Pattern p = java.util.regex.Pattern.compile("\\s*|\t*|\r*|\n*");
java.util.regex.Matcher m = p.matcher(strName);
String after = m.replaceAll("");
String temp = after.replaceAll("\\p{P}", "");
char[] ch = temp.trim().toCharArray();
float chLength = 0;
float count = 0;
for (int i = 0; i < ch.length; i++) {
char c = ch[i];
if (!Character.isLetterOrDigit(c)) {
if (!isChinese(c)) {
count = count + 1;
}
chLength++;
}
}
return count / chLength > 0.4;
}
/**
* 為防止頁面?zhèn)鬟M(jìn)來的內(nèi)容因為編碼不同等原因造成亂碼,這里作統(tǒng)一的轉(zhuǎn)換
*
* @param parameterName
* @return
*/
public static String decode(javax.servlet.http.HttpServletRequest request, String parameterName) {
String str;
if ((str = request.getParameter(parameterName)) == null) {
return null;
}
try {
if (isMessyCode(str)) {
str = new String(str.getBytes("ISO-8859-1"), "UTF-8");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("GB2312"), "UTF-8");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("GBK"), "UTF-8");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("UTF-8"), "ISO-8859-1");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("GB2312"), "ISO-8859-1");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("GBK"), "ISO-8859-1");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("UTF-8"), "GB2312");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("ISO-8859-1"), "GB2312");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("GBK"), "GB2312");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("UTF-8"), "GBK");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("ISO-8859-1"), "GBK");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("GB2312"), "GBK");
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(parameterName + "==" + str.trim());
return str.trim();
}
}
(6)包com.demo.vo
①? 公告(t_notice表對應(yīng)的Java實體類)
package com.demo.vo;
import java.io.Serializable;
public class Notice implements Serializable {
private Long id;//主鍵
private String noticeName;//標(biāo)題
private String noticeText;//內(nèi)容
private String noticeType;//類型
private String createDate;//創(chuàng)建時間
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNoticeName() {
return noticeName;
}
public void setNoticeName(String noticeName) {
this.noticeName = noticeName;
}
public String getNoticeText() {
return noticeText;
}
public void setNoticeText(String noticeText) {
this.noticeText = noticeText;
}
public String getNoticeType() {
return noticeType;
}
public void setNoticeType(String noticeType) {
this.noticeType = noticeType;
}
public String getCreateDate() {
return createDate;
}
public void setCreateDate(String createDate) {
this.createDate = createDate;
}
}
②? 成績信息(t_score表對應(yīng)的Java實體類)
package com.demo.vo;
import java.io.Serializable;
public class Score implements Serializable {
private Long id;//主鍵
private String scoreNumber;//學(xué)號
private String scoreName;//姓名
private String scoreCourse;//課程名
private String scoreScore;//分?jǐn)?shù)
private String scoreTotal;//總分
private String scoreAverage;//平均分
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getScoreNumber() {
return scoreNumber;
}
public void setScoreNumber(String scoreNumber) {
this.scoreNumber = scoreNumber;
}
public String getScoreName() {
return scoreName;
}
public void setScoreName(String scoreName) {
this.scoreName = scoreName;
}
public String getScoreCourse() {
return scoreCourse;
}
public void setScoreCourse(String scoreCourse) {
this.scoreCourse = scoreCourse;
}
public String getScoreScore() {
return scoreScore;
}
public void setScoreScore(String scoreScore) {
this.scoreScore = scoreScore;
}
public String getScoreTotal() {
return scoreTotal;
}
public void setScoreTotal(String scoreTotal) {
this.scoreTotal = scoreTotal;
}
public String getScoreAverage() {
return scoreAverage;
}
public void setScoreAverage(String scoreAverage) {
this.scoreAverage = scoreAverage;
}
}
③? 學(xué)生信息(t_student表對應(yīng)的Java實體類)
package com.demo.vo;
import java.io.Serializable;
public class Student implements Serializable {
private Long id;//主鍵
private String studentName;//姓名
private String studentAge;//年齡
private String studentSex;//性別:男/女
private String studentNumber;//學(xué)號
private String studentMaster;//專業(yè)
private String studentClass;//班級
private String studentPhone;//聯(lián)系方式
private String studentCourse;//課程
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getStudentName() {
return studentName;
}
public void setStudentName(String studentName) {
this.studentName = studentName;
}
public String getStudentAge() {
return studentAge;
}
public void setStudentAge(String studentAge) {
this.studentAge = studentAge;
}
public String getStudentSex() {
return studentSex;
}
public void setStudentSex(String studentSex) {
this.studentSex = studentSex;
}
public String getStudentNumber() {
return studentNumber;
}
public void setStudentNumber(String studentNumber) {
this.studentNumber = studentNumber;
}
public String getStudentMaster() {
return studentMaster;
}
public void setStudentMaster(String studentMaster) {
this.studentMaster = studentMaster;
}
public String getStudentClass() {
return studentClass;
}
public void setStudentClass(String studentClass) {
this.studentClass = studentClass;
}
public String getStudentPhone() {
return studentPhone;
}
public void setStudentPhone(String studentPhone) {
this.studentPhone = studentPhone;
}
public String getStudentCourse() {
return studentCourse;
}
public void setStudentCourse(String studentCourse) {
this.studentCourse = studentCourse;
}
}
④? 用戶(t_user表對應(yīng)的Java實體類)
package com.demo.vo;
import java.io.Serializable;
public class User implements Serializable {
private Long id;//主鍵
private String username;//用戶名
private String password;//密碼
private String realName;//姓名
private String userSex;//性別:男/女
private String userPhone;//手機(jī)
private String userText;//備注
private String userType;//類型:管理員/普通用戶
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getUserSex() {
return userSex;
}
public void setUserSex(String userSex) {
this.userSex = userSex;
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public String getUserText() {
return userText;
}
public void setUserText(String userText) {
this.userText = userText;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
}
?4、用戶的信息展示,添加,刪除,修改功能(只展示了添加代碼)
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>用戶添加</title>
<%@ include file="include/head.jsp" %>
</head>
<body>
<div class="container-fluid">
<ul class="nav nav-tabs">
<li><a href="UserServlet?action=list">用戶列表</a></li>
<li class="active"><a href="#">添加用戶</a></li>
</ul>
<br/>
<form class="form-horizontal" role="form" action="UserServlet?action=add" method="post" onsubmit="return check()">
<div class="form-group">
<label class="col-sm-3 control-label">用戶名:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="username" name="username">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">密碼:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="password" name="password">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">姓名:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="realName" name="realName">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">性別:</label>
<div class="col-sm-5">
<input name="userSex" type="radio" value="男" checked="checked"/> 男
<input name="userSex" type="radio" value="女"/> 女
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">手機(jī):</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="userPhone" name="userPhone">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">備注:</label>
<div class="col-sm-5">
<textarea rows="3" class="form-control" id="userText" name="userText" placeholder="請輸入內(nèi)容......"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">類型:</label>
<div class="col-sm-5">
<input name="userType" type="radio" value="超級管理員" checked="checked"/> 超級管理員
<input name="userType" type="radio" value="教師"/> 教師
<input name="userType" type="radio" value="學(xué)生"/> 學(xué)生
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-5">
<input type="submit" class="btn btn-pill btn-line btn-info btn-sm" value="保存">
<input type="button" class="btn btn-pill btn-line btn-warning btn-sm" value="返回" onclick="javascript:history.back(-1);">
</div>
</div>
</form>
</div>
</body>
<script type="text/javascript">
//提交之前進(jìn)行檢查,如果return false,則不允許提交
function check() {
//根據(jù)ID獲取值
if (document.getElementById("username").value.trim().length == 0) {
alert("用戶名不能為空!");
return false;
}
if (document.getElementById("password").value.trim().length == 0) {
alert("密碼不能為空!");
return false;
}
if (document.getElementById("realName").value.trim().length == 0) {
alert("姓名不能為空!");
return false;
}
if (document.getElementById("userPhone").value.trim().length == 0) {
alert("手機(jī)不能為空!");
return false;
}
return true;
}
</script>
</html>
5、學(xué)生的信息展示,添加,刪除,修改功能(只展示了添加代碼)
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>用戶添加</title>
<%@ include file="include/head.jsp" %>
</head>
<body>
<div class="container-fluid">
<ul class="nav nav-tabs">
<li><a href="UserServlet?action=list">用戶列表</a></li>
<li class="active"><a href="#">添加用戶</a></li>
</ul>
<br/>
<form class="form-horizontal" role="form" action="UserServlet?action=add" method="post" onsubmit="return check()">
<div class="form-group">
<label class="col-sm-3 control-label">用戶名:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="username" name="username">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">密碼:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="password" name="password">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">姓名:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="realName" name="realName">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">性別:</label>
<div class="col-sm-5">
<input name="userSex" type="radio" value="男" checked="checked"/> 男
<input name="userSex" type="radio" value="女"/> 女
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">手機(jī):</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="userPhone" name="userPhone">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">備注:</label>
<div class="col-sm-5">
<textarea rows="3" class="form-control" id="userText" name="userText" placeholder="請輸入內(nèi)容......"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">類型:</label>
<div class="col-sm-5">
<input name="userType" type="radio" value="超級管理員" checked="checked"/> 超級管理員
<input name="userType" type="radio" value="教師"/> 教師
<input name="userType" type="radio" value="學(xué)生"/> 學(xué)生
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-5">
<input type="submit" class="btn btn-pill btn-line btn-info btn-sm" value="保存">
<input type="button" class="btn btn-pill btn-line btn-warning btn-sm" value="返回" onclick="javascript:history.back(-1);">
</div>
</div>
</form>
</div>
</body>
<script type="text/javascript">
//提交之前進(jìn)行檢查,如果return false,則不允許提交
function check() {
//根據(jù)ID獲取值
if (document.getElementById("username").value.trim().length == 0) {
alert("用戶名不能為空!");
return false;
}
if (document.getElementById("password").value.trim().length == 0) {
alert("密碼不能為空!");
return false;
}
if (document.getElementById("realName").value.trim().length == 0) {
alert("姓名不能為空!");
return false;
}
if (document.getElementById("userPhone").value.trim().length == 0) {
alert("手機(jī)不能為空!");
return false;
}
return true;
}
</script>
</html>
6、成績的信息展示,添加,刪除,修改功能(只展示了添加代碼)
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>成績信息添加</title>
<%@ include file="include/head.jsp" %>
</head>
<body>
<div class="container-fluid">
<ul class="nav nav-tabs">
<li><a href="ScoreServlet?action=list">成績信息列表</a></li>
<li class="active"><a href="#">添加成績信息</a></li>
</ul>
<br/>
<form class="form-horizontal" role="form" action="ScoreServlet?action=add" method="post" onsubmit="return check()">
<div class="form-group">
<label class="col-sm-3 control-label">學(xué)號:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="scoreNumber" name="scoreNumber">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">姓名:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="scoreName" name="scoreName">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">面向?qū)ο蟪绦蛟O(shè)計:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="scoreCourse" name="scoreCourse">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">MySQL數(shù)據(jù)庫:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="scoreScore" name="scoreScore">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">總分:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="scoreTotal" name="scoreTotal">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">平均分:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="scoreAverage" name="scoreAverage">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-5">
<input type="submit" class="btn btn-pill btn-line btn-info btn-sm" value="保存">
<input type="button" class="btn btn-pill btn-line btn-warning btn-sm" value="返回" onclick="javascript:history.back(-1);">
</div>
</div>
</form>
</div>
</body>
<script type="text/javascript">
//提交之前進(jìn)行檢查,如果return false,則不允許提交
function check() {
//根據(jù)ID獲取值
if (document.getElementById("scoreNumber").value.trim().length == 0) {
alert("學(xué)號不能為空!");
return false;
}
if (document.getElementById("scoreName").value.trim().length == 0) {
alert("姓名不能為空!");
return false;
}
if (document.getElementById("scoreCourse").value.trim().length == 0) {
alert("課程名不能為空!");
return false;
}
if (document.getElementById("scoreScore").value.trim().length == 0) {
alert("分?jǐn)?shù)不能為空!");
return false;
}
if (document.getElementById("scoreTotal").value.trim().length == 0) {
alert("總分不能為空!");
return false;
}
if (document.getElementById("scoreAverage").value.trim().length == 0) {
alert("平均分不能為空!");
return false;
}
return true;
}
</script>
</html>
7、公告欄的信息展示,添加,刪除,修改功能(只展示了添加代碼)
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>公告添加</title>
<%@ include file="include/head.jsp" %>
</head>
<body>
<div class="container-fluid">
<ul class="nav nav-tabs">
<li><a href="NoticeServlet?action=list">公告列表</a></li>
<li class="active"><a href="#">添加</a></li>
</ul>
<br/>
<form class="form-horizontal" role="form" action="NoticeServlet?action=add" method="post" onsubmit="return check()">
<div class="form-group">
<label class="col-sm-3 control-label">標(biāo)題:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="noticeName" name="noticeName">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">內(nèi)容:</label>
<div class="col-sm-5">
<textarea rows="3" class="form-control" id="noticeText" name="noticeText" placeholder="請輸入內(nèi)容......"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">類型:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="noticeType" name="noticeType">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">創(chuàng)建時間:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="createDate" name="createDate">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-5">
<input type="submit" class="btn btn-pill btn-line btn-info btn-sm" value="保存">
<input type="button" class="btn btn-pill btn-line btn-warning btn-sm" value="返回" onclick="javascript:history.back(-1);">
</div>
</div>
</form>
</div>
</body>
<script type="text/javascript">
//提交之前進(jìn)行檢查,如果return false,則不允許提交
function check() {
//根據(jù)ID獲取值
if (document.getElementById("noticeName").value.trim().length == 0) {
alert("標(biāo)題不能為空!");
return false;
}
if (document.getElementById("noticeType").value.trim().length == 0) {
alert("類型不能為空!");
return false;
}
if (document.getElementById("createDate").value.trim().length == 0) {
alert("創(chuàng)建時間不能為空!");
return false;
}
return true;
}
</script>
</html>
代碼很多,這里就不做過多的展示啦!有想要源碼的可以私信哦~
三、效果圖展示
登錄界面
?登錄成功后主界面
? ? ? ?本次登錄的是用戶名為a的那個賬號,此賬號的身份是教師,所以超級管理員的信息咱們只能查看,不能修改。學(xué)生的信息可以隨意修改。
?學(xué)生信息管理界面
? ? ? ?咱們作為教師,學(xué)生的信息當(dāng)然也是可以修改的,這個界面里還可以添加學(xué)生,如果學(xué)生過多的話,也是可以通過查詢按鈕來快速找到我們想要查看的那位學(xué)生的信息。
?學(xué)生成績信息管理界面
? ? ? ?我們也是可以修改學(xué)生的成績信息的,當(dāng)然必不可少的快速查詢和添加成績信息的功能,我們在學(xué)生信息界面添加了一個學(xué)生的話,是沒有成績的,所以就需要在這里來添加新同學(xué)的成績信息。?
公告欄界面
? ? ? ?作為老師,不能更改公告欄的信息,因為這是校公告欄,只能由超級管理員來進(jìn)行 編輯與添加(這里我寫的公告內(nèi)容是關(guān)于我學(xué)校的,所以就碼住啦?。?/p>
個人中心界面
最后還有一個個人中心界面,是用來修改自己的密碼的~
?四、總結(jié)
? ? ? ?以上就是我本次分享的所有內(nèi)容啦,因為是第一次寫博客,有些地方解釋的不到位,請多多包涵。由于本系統(tǒng)是動態(tài)網(wǎng)頁,所以還有很多細(xì)節(jié)代碼沒有展示出來,本文僅展示了部分界面的主要代碼,各位大神若發(fā)現(xiàn)問題還請留言指出,歡迎各位交流學(xué)習(xí)。文章來源:http://www.zghlxwxcb.cn/news/detail-751894.html
需要源代碼文件以及MYSQL腳本的同學(xué)可以私信~文章來源地址http://www.zghlxwxcb.cn/news/detail-751894.html
到了這里,關(guān)于【JAVA】Eclipse+MYSQL數(shù)據(jù)庫+JSP+基礎(chǔ)Servlet開發(fā)JavaWeb學(xué)生信息管理系統(tǒng)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!