idea开发SSM框架的高校大学学生社团管理网站bootstrap自适应响应式前端(javaweb-php-asp.netC#-j2ee)包含公告管理-社团活动管理-社团申请管理-社团审核-活动报名

 

目录

 

 

0、效果展示

1、概述

2、社团管理网站搭建环境

3、数据表结构

​4、后端代码示例

5、前端代码示例

 


 

0、效果展示

 

 

1、概述

 

高校学生社团是高校学生依据兴趣爱好自愿组成,按照章程自主开展活动的学生组织。学生社团是高校校园文化的重要载体,是高校第二课堂的重要组成部分,参与学生社团,是学生丰富校园生活,培养兴趣爱好,扩大求知领域,增加交际范围,充实内心世界的重要方式。它既是学生思想政治工作的一个渠道,又是高校育人的有效途径;它对于营造学校的文化氛围,构筑学校的历史传统,都有着重要的意义。随着教育体制改革的不断深入以及大学生学习、生活方式的变化,高校学生社团日益成为高校中具有重大影响力和凝聚力的群体。

 

2、社团管理网站搭建环境

 

本文以实现一个社团管理网站为目标,从环境搭建到编码实现全过程讲述

我们使用javaweb、J2EE来构建社团管理网站,环境使用最新版jdk和tomcat,配合mysql数据库

开发工具使用idea(也可以使用eclipse),数据库管理工具使用Navicat Premium 

开发框架使用JavaBean Servlet MVC结构;

没有使用SSH(Struts+Spring+Hibernate)或SSM(Spring+SpringMVC+MyBatis),这两个框架我们在别的项目中再介绍开发过程

 

 

3、数据表结构

 

​4、后端代码示例

 

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.orm.Tuser;

import com.dao.DB;
import com.orm.TAdmin;
import com.orm.Tpingjia;
import com.orm.Tshetuan;
import com.service.liuService;

public class shetuan_servlet extends HttpServlet {
	public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
		String type = req.getParameter("type");

		if (type.endsWith("shetuanAddPre")) {
			shetuanAddPre(req, res);
		}
		if (type.endsWith("shetuanAdd")) {
			shetuanAdd(req, res);
		}
		if (type.endsWith("shetuanMana")) {
			shetuanMana(req, res);
		}
		if (type.endsWith("shetuanDel")) {
			shetuanDel(req, res);
		}
		if (type.endsWith("shetuanTongguo")) {
			shetuanTongguo(req, res);
		}
		if (type.endsWith("shetuanNOTongguo")) {
			shetuanNOTongguo(req, res);
		}
		if (type.endsWith("shetuanDetailHou")) {
			shetuanDetailHou(req, res);
		}
		if (type.endsWith("shetuanDetailHouSave")) {
			shetuanDetailHouSave(req, res);
		}
		if (type.endsWith("shetuanEditPre")) {
			shetuanEditPre(req, res);
		}
		if (type.endsWith("shetuanEdit")) {
			shetuanEdit(req, res);
		}
		if (type.endsWith("shetuan_suoyou")) {
			shetuan_suoyou(req, res);
		}

		if (type.endsWith("shetuanAll")) {
			shetuanAll(req, res);
		}
		if (type.endsWith("shetuanDetailQian")) {
			shetuanDetailQian(req, res);
		}
		if (type.endsWith("shetuan_search")) {
			shetuan_search(req, res);
		}
	}

	public void shetuanAddPre(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {

		List userList = new ArrayList();
		String sql = "select * from t_user where del='no'";
		Object[] params = {};
		DB mydb = new DB();
		try {
			mydb.doPstm(sql, params);
			ResultSet rs = mydb.getRs();
			while (rs.next()) {
				Tuser user = new Tuser();

				user.setId(rs.getString("id"));

				user.setName(rs.getString("name"));

				userList.add(user);
			}
			rs.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		mydb.closed();

		req.setAttribute("userList", userList);
		req.getRequestDispatcher("admin/shetuan/shetuanAdd.jsp").forward(req, res);
	}

	public void shetuanAdd(HttpServletRequest req, HttpServletResponse res) {
		String mingcheng = req.getParameter("mingcheng");
		String fuzeren = req.getParameter("fuzeren");
		String jieshao = req.getParameter("jieshao");
		String lishijian = req.getParameter("lishijian");
		String jiaoshi = req.getParameter("jiaoshi");
		String typename = req.getParameter("typename");
		String del = "no";

		String sql = "insert into t_shetuan(mingcheng,typename,fuzeren,jieshao,lishijian,del,jiaoshi) values(?,?,?,?,?,?,?)";
		Object[] params = { mingcheng, typename, fuzeren, jieshao, lishijian, del, jiaoshi };
		DB mydb = new DB();
		mydb.doPstm(sql, params);
		mydb.closed();

		req.setAttribute("message", "操作成功");
		req.setAttribute("path", "shetuan?type=shetuanMana");

		String targetURL = "/common/success.jsp";
		dispatch(targetURL, req, res);
	}

	public void shetuanMana(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {

		String userid = "";
		if (req.getSession().getAttribute("user") != null) {
			Tuser user = (Tuser) req.getSession().getAttribute("user");
			userid = user.getId();
		}

		List shetuanList = new ArrayList();
		String sql = "select * from t_shetuan where del='no'";
		if (req.getSession().getAttribute("user") != null)
			sql += " and  fuzeren='" + userid + "' ";
		Object[] params = {};
		DB mydb = new DB();
		try {
			mydb.doPstm(sql, params);
			ResultSet rs = mydb.getRs();
			while (rs.next()) {
				Tshetuan shetuan = new Tshetuan();

				shetuan.setId(rs.getInt("id"));
				shetuan.setMingcheng(rs.getString("mingcheng"));
				shetuan.setTypename(rs.getString("typename"));
				shetuan.setFuzeren(rs.getString("fuzeren"));
				shetuan.setJieshao((rs.getString("jieshao")));
				shetuan.setLishijian(rs.getString("lishijian"));
				shetuan.setJiaoshi(rs.getString("jiaoshi"));
				shetuan.setSenhe(rs.getString("senhe"));
				shetuan.setDel(rs.getString("del"));

				shetuan.setUser(liuService.getUser(rs.getString("fuzeren")));
				shetuanList.add(shetuan);
			}
			rs.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		mydb.closed();

		req.setAttribute("shetuanList", shetuanList);
		req.getRequestDispatcher("admin/shetuan/shetuanMana.jsp").forward(req, res);
	}

	// 删除
	public void shetuanDel(HttpServletRequest req, HttpServletResponse res) {
		String sql = "update t_shetuan 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", "shetuan?type=shetuanMana");

		String targetURL = "/common/success.jsp";
		dispatch(targetURL, req, res);
	}

	// 通过

	public void shetuanTongguo(HttpServletRequest req, HttpServletResponse res) {
		String sql = "update t_shetuan set senhe='通过' 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", "shetuan?type=shetuanMana");

		String targetURL = "/common/success.jsp";
		dispatch(targetURL, req, res);
	}

	// 不通过
	public void shetuanNOTongguo(HttpServletRequest req, HttpServletResponse res) {
		String sql = "update t_shetuan set senhe='不通过' 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", "shetuan?type=shetuanMana");

		String targetURL = "/common/success.jsp";
		dispatch(targetURL, req, res);
	}

	public void shetuanEditPre(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {

		String id = req.getParameter("id");
		List userList = new ArrayList();
		String sql = "select * from t_user where del='no'";
		Object[] params = {};
		DB mydb = new DB();
		try {
			mydb.doPstm(sql, params);
			ResultSet rs = mydb.getRs();
			while (rs.next()) {
				Tuser user = new Tuser();

				user.setId(rs.getString("id"));

				user.setName(rs.getString("name"));

				userList.add(user);
			}
			rs.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		mydb.closed();

		req.setAttribute("userList", userList);
		req.setAttribute("id", id);
		req.getRequestDispatcher("admin/shetuan/shetuanEditPre.jsp").forward(req, res);
	}

	public void shetuanEdit(HttpServletRequest req, HttpServletResponse res) {
		String fuzeren = req.getParameter("fuzeren");

		String id = req.getParameter("id");

		String sql = "update t_shetuan set fuzeren=? where id=" + Integer.parseInt(req.getParameter("id"));
		Object[] params = { fuzeren };
		DB mydb = new DB();
		mydb.doPstm(sql, params);
		mydb.closed();

		req.setAttribute("message", "操作成功");
		req.setAttribute("path", "shetuan?type=shetuanMana");

		String targetURL = "/common/success.jsp";
		dispatch(targetURL, req, res);
	}

	public void shetuanDetailHou(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
		Tshetuan shetuan = new Tshetuan();
		String sql = "select * from t_shetuan where id=" + Integer.parseInt(req.getParameter("id"));
		Object[] params = {};
		DB mydb = new DB();
		try {
			mydb.doPstm(sql, params);
			ResultSet rs = mydb.getRs();
			while (rs.next()) {
				shetuan.setId(rs.getInt("id"));
				shetuan.setMingcheng(rs.getString("mingcheng"));
				shetuan.setFuzeren(rs.getString("fuzeren"));
				shetuan.setTypename(rs.getString("typename"));
				shetuan.setJieshao(rs.getString("jieshao"));
				shetuan.setLishijian(rs.getString("lishijian"));
				shetuan.setJiaoshi(rs.getString("jiaoshi"));
				shetuan.setDel(rs.getString("del"));
			}
			rs.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		mydb.closed();
		req.setAttribute("id", req.getParameter("id"));
		req.setAttribute("shetuan", shetuan);
		req.getRequestDispatcher("admin/shetuan/shetuanDetailHou.jsp").forward(req, res);
	}

	public void shetuanDetailHouSave(HttpServletRequest req, HttpServletResponse res) {

		String id = req.getParameter("id");
		String mingcheng = req.getParameter("mingcheng");
		String jieshao = req.getParameter("jieshao");
		String lishijian = req.getParameter("lishijian");
		String jiaoshi = req.getParameter("jiaoshi");
		String typename = req.getParameter("typename");

		String sql = "update t_shetuan set mingcheng=?,jieshao=?,lishijian=?,jiaoshi=?,typename=? where id="
				+ Integer.parseInt(req.getParameter("id"));
		Object[] params = { mingcheng, jieshao, lishijian, jiaoshi, typename };
		DB mydb = new DB();
		mydb.doPstm(sql, params);
		mydb.closed();

		req.setAttribute("message", "操作成功");
		req.setAttribute("path", "shetuan?type=shetuanMana");

		String targetURL = "/common/success.jsp";
		dispatch(targetURL, req, res);
	}

	public void shetuan_suoyou(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {

		String userid = "";
		if (req.getSession().getAttribute("user") != null) {
			Tuser user = (Tuser) req.getSession().getAttribute("user");
			userid = user.getId();
		}

		List shetuanList = new ArrayList();
		String sql = "select * from t_shetuan where del='no'";
		if (req.getSession().getAttribute("user") != null)
			sql += " and  fuzeren='" + userid + "' ";
		Object[] params = {};
		DB mydb = new DB();
		try {
			mydb.doPstm(sql, params);
			ResultSet rs = mydb.getRs();
			while (rs.next()) {
				Tshetuan shetuan = new Tshetuan();

				shetuan.setId(rs.getInt("id"));
				shetuan.setMingcheng(rs.getString("mingcheng"));
				shetuan.setTypename(rs.getString("typename"));
				shetuan.setFuzeren(rs.getString("fuzeren"));
				shetuan.setJieshao((rs.getString("jieshao")));
				shetuan.setLishijian(rs.getString("lishijian"));
				shetuan.setDel(rs.getString("del"));
				shetuan.setJiaoshi(rs.getString("jiaoshi"));

				shetuanList.add(shetuan);
			}
			rs.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		mydb.closed();

		req.setAttribute("shetuanList", shetuanList);
		req.getRequestDispatcher("admin/shetuan/shetuan_suoyou.jsp").forward(req, res);
	}

	public void shetuanAll(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
		List shetuanList = new ArrayList();
		String sql = "select * from t_shetuan where del='no' and senhe='通过'";
		Object[] params = {};
		DB mydb = new DB();
		try {
			mydb.doPstm(sql, params);
			ResultSet rs = mydb.getRs();
			while (rs.next()) {
				Tshetuan shetuan = new Tshetuan();

				shetuan.setId(rs.getInt("id"));
				shetuan.setMingcheng(rs.getString("mingcheng"));
				shetuan.setTypename(rs.getString("typename"));
				shetuan.setFuzeren(rs.getString("fuzeren"));
				shetuan.setJieshao(rs.getString("jieshao"));
				shetuan.setLishijian(rs.getString("lishijian"));
				shetuan.setDel(rs.getString("del"));
				shetuan.setJiaoshi(rs.getString("jiaoshi"));

				shetuanList.add(shetuan);
			}
			rs.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		mydb.closed();

		req.setAttribute("shetuanList", shetuanList);
		req.getRequestDispatcher("qiantai/shetuan/shetuanAll.jsp").forward(req, res);
	}

	public void shetuanDetailQian(HttpServletRequest req, HttpServletResponse res)
			throws ServletException, IOException {
		Tshetuan shetuan = new Tshetuan();
		String sql = "select * from t_shetuan where id=" + Integer.parseInt(req.getParameter("id"));
		Object[] params = {};
		DB mydb = new DB();
		try {
			mydb.doPstm(sql, params);
			ResultSet rs = mydb.getRs();
			while (rs.next()) {
				shetuan.setId(rs.getInt("id"));
				shetuan.setMingcheng(rs.getString("mingcheng"));
				shetuan.setTypename(rs.getString("typename"));
				shetuan.setFuzeren(rs.getString("fuzeren"));
				shetuan.setJieshao(rs.getString("jieshao"));
				shetuan.setLishijian(rs.getString("lishijian"));
				shetuan.setDel(rs.getString("del"));
				shetuan.setJiaoshi(rs.getString("jiaoshi"));
				shetuan.setUser(liuService.getUser(rs.getString("fuzeren")));
			}
			rs.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		mydb.closed();

		// 评价信息
		List pingjiaList = new ArrayList();
		sql = "select * from t_pingjia where del='no' and shetuan_id=? order by shetuan_id";
		Object[] params1 = { req.getParameter("id") };
		mydb = new DB();
		try {
			mydb.doPstm(sql, params1);
			ResultSet rs = mydb.getRs();
			while (rs.next()) {
				Tpingjia pingjia = new Tpingjia();

				pingjia.setId(rs.getInt("id"));
				pingjia.setShetuan_id(rs.getInt("shetuan_id"));
				pingjia.setNeirong(rs.getString("neirong"));

				pingjia.setShijian(rs.getString("shijian"));
				pingjia.setHuifu(rs.getString("huifu"));
				pingjia.setDel(rs.getString("del"));

				pingjia.setShetuan(liuService.get_shetuan(rs.getInt("shetuan_id")));

				pingjiaList.add(pingjia);
			}
			rs.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		mydb.closed();

		req.setAttribute("pingjiaList", pingjiaList);

		req.setAttribute("shetuan", shetuan);
		req.getRequestDispatcher("qiantai/shetuan/shetuanDetailQian.jsp").forward(req, res);
	}

	public void shetuan_search(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
		List shetuanList = new ArrayList();
		String sql = "select * from t_shetuan where del='no' and mingcheng like '%"
				+ req.getParameter("mingcheng").trim() + "%'";
		Object[] params = {};
		DB mydb = new DB();
		try {
			mydb.doPstm(sql, params);
			ResultSet rs = mydb.getRs();
			while (rs.next()) {
				Tshetuan shetuan = new Tshetuan();

				shetuan.setId(rs.getInt("id"));
				shetuan.setMingcheng(rs.getString("mingcheng"));
				shetuan.setFuzeren(rs.getString("fuzeren"));
				shetuan.setTypename(rs.getString("typename"));
				shetuan.setJieshao(rs.getString("jieshao"));
				shetuan.setLishijian(rs.getString("lishijian"));
				shetuan.setDel(rs.getString("del"));
				shetuan.setJiaoshi(rs.getString("jiaoshi"));

				shetuanList.add(shetuan);
			}
			rs.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		mydb.closed();

		req.setAttribute("shetuanList", shetuanList);
		req.getRequestDispatcher("qiantai/shetuan/shetuanAll.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() {

	}
}

5、前端代码示例

 

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false"%>
<%
	String path = request.getContextPath();
%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">

<head>

<title>学院社团网站</title>
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">    <LINK href="<%=path%>/css/css.css" type=text/css rel="stylesheet">
<link rel="stylesheet" type="text/css"
	href="<%=path%>/css/bootstrap.css">
<!--bootstrap框架-->
<link rel="stylesheet" type="text/css"
	href="<%=path%>/css/bootstyle.css">
<!--网站主框-->
<link rel="stylesheet" type="text/css"
	href="<%=path%>/css/responsive.css">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<body>
	<jsp:include flush="true" page="/qiantai/inc/incTop.jsp"></jsp:include>

	<section class=" ">
		<div class="container">

			<div class="row">
				<!--左栏-->
				<jsp:include flush="true" page="/qiantai/inc/incLeft.jsp"></jsp:include>


				<!--右栏-->
				<div class="col-md-8 boxl">
					<div class="course">

						<img src="images/banner.jpg" width="670" height="230" class="minnodisplay" />
						<div class="  lay3">

							<table border="0" width="100%">

								<tr>
									<td valign="top">
										<div
											style="height:20px; line-height:20px; border-bottom:solid #1A4A77 2px; margin-top:10px; text-align:left;">
											<span
												style="float:left; padding-left:5px; font-size:14px; font-weight:bold;">社团列表</span>
										</div>
										<div class="r_b3" style="height:120px;">
											<c:forEach items="${requestScope.shetuanList}" var="shetuan">
												<li><span>[${shetuan.lishijian}]</span>(${shetuan.typename})<a
													href="<%=path %>/shetuan?type=shetuanDetailQian&id=${shetuan.id}">${shetuan.mingcheng}</a>
												</li>
											</c:forEach>
										</div>
									</td>
									<td valign="top">
										<div
											style="height:20px; line-height:20px; border-bottom:solid #1A4A77 2px; margin-top:10px; text-align:left;">
											<span
												style="float:left; padding-left:5px; font-size:14px; font-weight:bold;">社团活动</span>
										</div>
										<div class="r_b3" style="height:120px;">
											<c:forEach items="${requestScope.huodongList}" var="huodong">
												<li><span>[${huodong.shijian}]</span>
													(${huodong.typename}) ${huodong.shetuan.mingcheng} <a
													href="<%=path %>/huodong?type=huodongDetailQian&id=${huodong.id}">${huodong.biaoti}</a>
												</li>
											</c:forEach>
										</div>
									</td>
								</tr>
								<tr>
									<td valign="top">


										<div
											style="height:20px; line-height:20px; border-bottom:solid #1A4A77 2px; margin-top:10px; text-align:left;">
											<span
												style="float:left; padding-left:5px; font-size:14px; font-weight:bold;">社团公告</span>
										</div>
										<div class="r_b3" style="height:120px;">
											<c:forEach items="${requestScope.wenhuaList}" var="wenhua">
												<li><span>[${wenhua.shijian}]</span>${wenhua.shetuan.mingcheng}
													<a
													href="<%=path %>/wenhua?type=wenhuaDetailQian&id=${wenhua.id}">${wenhua.biaoti}</a>
												</li>

											</c:forEach>

										</div>
									</td>
									<td valign="top">
										<div
											style="height:20px; line-height:20px; border-bottom:solid #1A4A77 2px; margin-top:10px; text-align:left;">
											<span
												style="float:left; padding-left:5px; font-size:14px; font-weight:bold;">公告通知</span>
										</div>
										<div class="r_b3" style="height:120px;">
											<c:forEach items="${requestScope.downList}" var="down">
												<li><span>[${down.shijian}]</span>${down.shetuan.mingcheng}
													<a href="<%=path %>/down?type=downDetailQian&id=${down.id}">${down.biaoti}</a></li>


											</c:forEach>


										</div>
									</td>
								</tr>
							</table>


						</div>
					</div>
				</div>





			</div>
		</div>
	</section>

	<jsp:include flush="true" page="/qiantai/inc/incFoot.jsp"></jsp:include>
</body>
</html>

 

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

计算机程序设计开发

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值