目录
1 概述
2 数据库表
3 关键代码
4 效果演示
1 概述
本系统主要使用JSP、Struts技术B/S结构,即Browser/Server(浏览器/服务器)结构对系统进行设计和开发。
《毕业论文管理系统》主要是针对学校涉及《毕业论文管理系统》平台的一系列相关工作的管理,本系统的建立使学校的管理更加规范化、系统化,查询手段更加便捷化。同时,《毕业论文管理系统》也是实现学校教学管理现代化和信息化的重要内容。
2 数据库表
表t _admin 管理员表
字段名称 |
字段大小 |
字段类型 |
允许空 |
说明 |
userId |
4 |
长整型(3) |
× |
用户编号 |
userName |
50 |
文本(202) |
√ |
用户名称 |
userPw |
50 |
文本(202) |
√ |
用户密码 |
表2 t_banji 班级表
字段名称 |
字段大小 |
字段类型 |
允许空 |
说明 |
id |
4 |
长整型(3) |
× |
编号 |
name |
50 |
文本(202) |
√ |
名称 |
del |
50 |
文本(202) |
√ |
- |
表3 t_doc 资源表
字段名称 |
字段大小 |
字段类型 |
允许空 |
说明 |
id |
50 |
文本(202) |
× |
编号 |
title |
50 |
文本(202) |
√ |
标题 |
content |
536870910 |
备注/超级链接(203) |
√ |
内容 |
fujian |
50 |
文本(202) |
√ |
复件 |
fujianYuanshiming |
50 |
文本(202) |
√ |
复件原始名 |
shijian |
50 |
文本(202) |
√ |
时间 |
del |
50 |
文本(202) |
√ |
是否删除 |
表4 t_gonggao公告表
字段名称 |
字段大小 |
字段类型 |
允许空 |
说明 |
id |
50 |
文本(202) |
× |
编号 |
title |
50 |
文本(202) |
√ |
标题 |
content |
50 |
文本(202) |
√ |
内容 |
shijian |
50 |
文本(202) |
√ |
时间 |
3 关键代码
package com.action;import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import com.dao.DB;
import com.orm.TAdmin;
import com.orm.Tgonggao;public class gonggao_servlet extends HttpServlet
{public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException {String type=req.getParameter("type");if(type.endsWith("gonggaoAdd")){gonggaoAdd(req, res);}if(type.endsWith("gonggaoMana")){gonggaoMana(req, res);}if(type.endsWith("gonggaoDel")){gonggaoDel(req, res);}if(type.endsWith("gonggaoDetail")){gonggaoDetail(req, res);}if(type.endsWith("gonggaoDetailQian")){gonggaoDetailQian(req, res);}}public void gonggaoAdd(HttpServletRequest req,HttpServletResponse res){String id=String.valueOf(new Date().getTime());String title=req.getParameter("title");String content=req.getParameter("content");String shijian=new Date().toLocaleString();String sql="insert into t_gonggao values(?,?,?,?)";Object[] params={id,title,content,shijian};DB mydb=new DB();mydb.doPstm(sql, params);mydb.closed();req.setAttribute("message", "操作成功");req.setAttribute("path", "gonggao?type=gonggaoMana");String targetURL = "/common/success.jsp";dispatch(targetURL, req, res);}public void gonggaoDel(HttpServletRequest req,HttpServletResponse res){String id=req.getParameter("id");String sql="delete from t_gonggao where id=?";Object[] params={id};DB mydb=new DB();mydb.doPstm(sql, params);mydb.closed();req.setAttribute("message", "操作成功");req.setAttribute("path", "gonggao?type=gonggaoMana");String targetURL = "/common/success.jsp";dispatch(targetURL, req, res);}public void gonggaoMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException{List gonggaoList=new ArrayList();String sql="select * from t_gonggao";Object[] params={};DB mydb=new DB();try{mydb.doPstm(sql, params);ResultSet rs=mydb.getRs();while(rs.next()){Tgonggao gonggao=new Tgonggao();gonggao.setId(rs.getString("id"));gonggao.setTitle(rs.getString("title"));gonggao.setContent(rs.getString("content"));gonggao.setShijian(rs.getString("shijian"));gonggaoList.add(gonggao);}rs.close();}catch(Exception e){e.printStackTrace();}mydb.closed();req.setAttribute("gonggaoList", gonggaoList);req.getRequestDispatcher("admin/gonggao/gonggaoMana.jsp").forward(req, res);}public void gonggaoDetail(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException{String id=req.getParameter("id");Tgonggao gonggao=new Tgonggao();String sql="select * from t_gonggao where id=?";Object[] params={id};DB mydb=new DB();try{mydb.doPstm(sql, params);ResultSet rs=mydb.getRs();rs.next();gonggao.setId(rs.getString("id"));gonggao.setTitle(rs.getString("title"));gonggao.setContent(rs.getString("content"));gonggao.setShijian(rs.getString("shijian"));rs.close();}catch(Exception e){e.printStackTrace();}mydb.closed();req.setAttribute("gonggao", gonggao);req.getRequestDispatcher("admin/gonggao/gonggaoDetail.jsp").forward(req, res);}public void gonggaoDetailQian(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException{String id=req.getParameter("id");Tgonggao gonggao=new Tgonggao();String sql="select * from t_gonggao where id=?";Object[] params={id};DB mydb=new DB();try{mydb.doPstm(sql, params);ResultSet rs=mydb.getRs();rs.next();gonggao.setId(rs.getString("id"));gonggao.setTitle(rs.getString("title"));gonggao.setContent(rs.getString("content"));gonggao.setShijian(rs.getString("shijian"));rs.close();}catch(Exception e){e.printStackTrace();}mydb.closed();req.setAttribute("gonggao", gonggao);req.getRequestDispatcher("/qiantai/gonggao/gonggaoDetailQian.jsp").forward(req, res);}public void dispatch(String targetURI,HttpServletRequest request,HttpServletResponse response) {RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);try {dispatch.forward(request, response);return;} catch (ServletException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}}public void init(ServletConfig config) throws ServletException {super.init(config);}public void destroy() {}
}
package com.action;import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import com.dao.DB;
import com.orm.TAdmin;
import com.orm.Tbanji;
import com.service.liuService;public class banji_servlet extends HttpServlet
{public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException {String type=req.getParameter("type");if(type.endsWith("banjiMana")){banjiMana(req, res);}if(type.endsWith("banjiAdd")){banjiAdd(req, res);}if(type.endsWith("banjiDel")){banjiDel(req, res);}}public void banjiAdd(HttpServletRequest req,HttpServletResponse res){String name=req.getParameter("name");String del="no";String sql="insert into t_banji values(?,?)";Object[] params={name,del};DB mydb=new DB();mydb.doPstm(sql, params);mydb.closed();req.setAttribute("message", "操作成功");req.setAttribute("path", "banji?type=banjiMana");String targetURL = "/common/success.jsp";dispatch(targetURL, req, res);}public void banjiDel(HttpServletRequest req,HttpServletResponse res){String sql="update t_banji set del='yes' where id="+Integer.parseInt(req.getParameter("id"));Object[] params={};DB mydb=new DB();mydb.doPstm(sql, params);mydb.closed();req.setAttribute("message", "操作成功");req.setAttribute("path", "banji?type=banjiMana");String targetURL = "/common/success.jsp";dispatch(targetURL, req, res);}public void banjiMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException{List banjiList=new ArrayList();String sql="select * from t_banji where del='no'";Object[] params={};DB mydb=new DB();try{mydb.doPstm(sql, params);ResultSet rs=mydb.getRs();while(rs.next()){Tbanji banji=new Tbanji();banji.setId(rs.getInt("id"));banji.setName(rs.getString("name"));banjiList.add(banji);}rs.close();}catch(Exception e){e.printStackTrace();}mydb.closed();req.setAttribute("banjiList", banjiList);req.getRequestDispatcher("admin/banji/banjiMana.jsp").forward(req, res);}public void dispatch(String targetURI,HttpServletRequest request,HttpServletResponse response) {RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);try {dispatch.forward(request, response);return;} catch (ServletException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}}public void init(ServletConfig config) throws ServletException {super.init(config);}public void destroy() {}
}
4 效果演示