本文主要是介绍SSM框架60114-运动会赛事志愿者招募系统网站 (idea开发javaweb-php-asp.netC#-j2ee-springboot)简历发布审核-测试题库成绩管理-志愿者岗位管理,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1 概述
2 数据库表
表2t_zhishi知识表
字段名称 | 自动增长 | 字段类型 | 说明 |
id | - | int | 编号 |
title | - | varchar | 标题 |
content | - | varchar | 内容 |
fujian | - | varchar | 附件 |
shijian | - | varchar | 发布时间 |
del | - | varchar | 是否删除 |
表3 t_gonggao 公告内容表
名称 | 类型 | 说明 |
id | int(11) | 编号 |
title | longtext | 标题 |
content | longtext | 内容 |
shijian | longtext | 时间 |
3 关键代码
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 javax.servlet.http.HttpSession;import com.dao.DB;
import com.orm.TAdmin;
import com.orm.Tshenhe;public class shenhe_servlet extends HttpServlet {public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {String type = req.getParameter("type");if (type.equals("edit")) {edit(req, res);}if (type.endsWith("editsave")) {editsave(req, res);}if (type.endsWith("shenheMana")) {shenheMana(req, res);}if (type.endsWith("shenheAdd")) {shenheAdd(req, res);}if (type.endsWith("shenheReg")) {shenheReg(req, res);}if (type.endsWith("shenheDel")) {shenheDel(req, res);}}//审核员注册 public void shenheReg(HttpServletRequest req, HttpServletResponse res) {String bianhao = req.getParameter("bianhao");String name = req.getParameter("name");String sex = req.getParameter("sex");String loginpw = req.getParameter("loginpw");System.out.println(req.getParameter("age").trim());int age = Integer.parseInt(req.getParameter("age"));String del = "no";String sql = "insert into t_shenhe values(?,?,?,?,?,?,?)";Object[] params = { null, bianhao, name, sex, age, loginpw, del };DB mydb = new DB();mydb.doPstm(sql, params);mydb.closed();req.setAttribute("message", "操作成功");req.setAttribute("path", "index");String targetURL = "/common/success.jsp";dispatch(targetURL, req, res);}//后台添加审核员public void shenheAdd(HttpServletRequest req, HttpServletResponse res) {String bianhao = req.getParameter("bianhao");String name = req.getParameter("name");String sex = req.getParameter("sex");System.out.println(req.getParameter("age").trim());int age = Integer.parseInt(req.getParameter("age"));String loginpw = req.getParameter("loginpw");String del = "no";String sql = "insert into t_shenhe values(?,?,?,?,?,?,?)";Object[] params = { null, bianhao, name, sex, age, loginpw, del };DB mydb = new DB();mydb.doPstm(sql, params);mydb.closed();req.setAttribute("message", "操作成功");req.setAttribute("path", "shenhe?type=shenheMana");String targetURL = "/common/success.jsp";dispatch(targetURL, req, res);}public void shenheDel(HttpServletRequest req,HttpServletResponse res){//String sql="update t_shenhe set del='yes' where id="+Integer.parseInt(req.getParameter("id"));String sql = "delete from t_shenhe 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", "shenhe?type=shenheMana");String targetURL = "/common/success.jsp";dispatch(targetURL, req, res);}
//前面用户修改信息public void edit(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException{HttpSession session=req.getSession();Tshenhe shenhe=(Tshenhe)session.getAttribute("shenhe");int shenheid=shenhe.getId();//当前登录的用户的IDList shenheList=new ArrayList();String sql="select * from t_shenhe where del='no' and id='"+shenheid+"'";Object[] params={};DB mydb=new DB();try{mydb.doPstm(sql, params);ResultSet rs=mydb.getRs();while(rs.next()){Tshenhe shenhe1=new Tshenhe();shenhe1.setId(rs.getInt("id"));shenhe1.setBianhao(rs.getString("bianhao"));shenhe1.setName(rs.getString("name"));shenhe1.setSex(rs.getString("sex"));shenhe1.setAge(rs.getString("age"));shenheList.add(shenhe1);}rs.close();}catch(Exception e){e.printStackTrace();}mydb.closed();//req.setAttribute("putuserList", putuserList);req.setAttribute("shenheList", shenheList);req.getRequestDispatcher("qiantai/userinfo/shenhe_edit.jsp").forward(req, res);}// 前台用户修改信息保存public void editsave(HttpServletRequest req, HttpServletResponse res) {String name = req.getParameter("name");String sex = req.getParameter("sex");String loginpw = req.getParameter("loginpw");int age = Integer.parseInt(req.getParameter("age"));String sql = "";if(loginpw.equals(""))sql="update t_shenhe set sex='"+sex+"',age='"+age+"' ,name='"+name+"' where id="+Integer.parseInt(req.getParameter("id"));//密码为空则不修改密码if (!loginpw.equals("")){sql = "update t_shenhe set loginpw='" + loginpw + "',sex='"+sex+"',age='"+age+"' ,name='"+name+"' 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", "shenhe?type=edit");String targetURL = "/common/success.jsp";dispatch(targetURL, req, res);}public void shenheMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException{List shenheList=new ArrayList();String sql="select * from t_shenhe where del='no'";Object[] params={};DB mydb=new DB();try{mydb.doPstm(sql, params);ResultSet rs=mydb.getRs();while(rs.next()){Tshenhe shenhe=new Tshenhe();shenhe.setId(rs.getInt("id"));shenhe.setBianhao(rs.getString("bianhao"));shenhe.setName(rs.getString("name"));shenhe.setSex(rs.getString("sex"));shenhe.setAge(rs.getString("age"));shenheList.add(shenhe);}rs.close();}catch(Exception e){e.printStackTrace();}mydb.closed();req.setAttribute("shenheList", shenheList);req.getRequestDispatcher("admin/shenhe/shenheMana.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 效果演示
idea或eclipse开发,mysql数据库
这篇关于SSM框架60114-运动会赛事志愿者招募系统网站 (idea开发javaweb-php-asp.netC#-j2ee-springboot)简历发布审核-测试题库成绩管理-志愿者岗位管理的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!