Loading

2022期中测试题目-校园社团活动管理系统

题目要求:

校园社团作为高校课外活动的重要组成部分,发展十分迅速,也受到越来越多学生的欢迎,社团规模、数量等都在日益增长,社团活动也更为多样和丰富。然而,大多数高校还没有一个完整成熟的社团管理系统,仅仅是靠人力来管理,导致效率低下,而学生也只能通过线下或者公众号的方式了解社团,另外,社团活动的通知方式也很杂乱,并没有一个信息聚合、消息发布的平台。

因此,高校有必要建立一个校园社团管理系统,使得社团管理工作规范化、系统化、程序化、科学化,提高管理工作的效率。

 注:增删改查可以参考我下面这篇链接的博客

https://www.cnblogs.com/rsy-bxf150/p/17169968.html

其他项目:

1.地铁查询

https://www.cnblogs.com/rsy-bxf150/p/17253665.html

2.ajax简单增删改查

https://www.cnblogs.com/rsy-bxf150/p/17436728.html

 项目结构总览:

 部分代码:

Information.java
 1 package com.Bean;
 2 
 3 public class Information {
 4     private String theme;//活动主题1
 5     private String purpose;//活动目的2
 6     private String types;//活动类型3
 7     private String times;//活动时间4
 8     private String place;//活动地点5
 9     private String object;//活动对象6
10     private String content;//活动内容7
11     private String arrange;//活动安排8
12 
13     public String getTheme() {
14         return theme;
15     }
16 
17     public void setTheme(String theme) {    this.theme = theme; }//1
18 
19     public String getPurpose() {
20         return purpose;
21     }
22 
23     public void setPurpose(String purpose) {
24         this.purpose = purpose;
25     }//2
26 
27     public String getTypes() {
28         return types;
29     }
30 
31     public void setTypes(String types) {
32         this.types = types;
33     }//3
34 
35     public String getTimes() {
36         return times;
37     }
38 
39     public void setTimes(String times) {
40         this.times = times;
41     }//4
42 
43     public String getPlace() {
44         return place;
45     }
46 
47     public void setPlace(String place) {
48         this.place = place;
49     }//5
50 
51     public String getObject() {
52         return object;
53     }
54 
55     public void setObject(String object) {
56         this.object = object;
57     }//6
58 
59     public String getContent() {
60         return content;
61     }
62 
63     public void setContent(String content) {
64         this.content = content;
65     }//7
66 
67     public String getArrange() {
68         return arrange;
69     }
70 
71     public void setArrange(String arrange) {
72         this.arrange = arrange;
73     }//8
74 
75 
76 }

mannger.java

 1 package com.Dao;
 2 
 3 import java.sql.Connection;
 4 import java.sql.PreparedStatement;
 5 import java.sql.SQLException;
 6 
 7 import com.Bean.Information;
 8 import com.Util.utils;
 9 
10 public class mannger {
11 
12     // TODO Auto-generated method stub
13     public int add(Information A) throws ClassNotFoundException, SQLException {
14         Connection connection = utils.getConnection();
15         String sql = "insert into duixiang(theme,purpose,types,times,place,object,content,arrange) values(?,?,?,?,?,?,?,?)";
16         PreparedStatement preparedStatement = null;
17         int i=0;
18         try {
19             preparedStatement = connection.prepareStatement(sql);
20             preparedStatement.setString(1, A.getTheme());
21             preparedStatement.setString(2, A.getPurpose());
22             preparedStatement.setString(3, A.getTypes());
23             preparedStatement.setString(4, A.getTimes());
24             preparedStatement.setString(5, A.getPlace());
25             preparedStatement.setString(6,A.getObject());
26             preparedStatement.setString(7, A.getContent());
27             preparedStatement.setString(8, A.getArrange());
28             i = preparedStatement.executeUpdate();
29 
30         } catch (SQLException e) {
31             // TODO Auto-generated catch block
32             e.printStackTrace();
33         }finally {
34 
35         }
36         return i;
37     }
38 }

utils.java

 1 package com.Util;
 2 
 3 import com.mysql.cj.jdbc.Driver;
 4 import java.sql.Connection;
 5 import java.sql.DriverManager;
 6 import java.sql.PreparedStatement;
 7 import java.sql.ResultSet;
 8 import java.sql.SQLException;
 9 import java.sql.Statement;
10 
11 public class utils {
12     public static Connection getConnection() throws ClassNotFoundException, SQLException {
13 
14         Connection connection = null;
15         PreparedStatement ps = null;
16         ResultSet rs = null;
17         DriverManager.registerDriver(new com.mysql.cj.jdbc.Driver());
18         connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/mycommunity?useSSL=false&serverTimezone=UTC","root", "1506583922");
19         return connection;
20     }
21 
22     public static void close(Connection connection ) {
23         try {
24             if (connection != null) {
25                 connection.close();
26             }
27 
28         } catch (SQLException e) {
29             // TODO Auto-generated catch block
30             e.printStackTrace();
31         }
32     }
33     public static void close(PreparedStatement preparedStatement ) {
34         try {
35             if (preparedStatement != null) {
36                 preparedStatement.close();
37             }
38         } catch (SQLException e) {
39             // TODO Auto-generated catch block
40             e.printStackTrace();
41         }
42     }
43     public static void close(ResultSet resultSet ) {
44         try {
45             if (resultSet != null) {
46                 resultSet.close();
47             }
48 
49         } catch (SQLException e) {
50             // TODO Auto-generated catch block
51             e.printStackTrace();
52         }
53     }
54 }
add.java
package Servlet;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.Dao.mannger;
import com.Bean.Information;
/**
 * Servlet implementation class add
 */
@WebServlet("/add")
public class add extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#HttpServlet()
     */
    public add() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        doPost(request, response);
    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");

        mannger A =new mannger();
        int i = 0;
        String theme = request.getParameter("theme");
        String purpose = request.getParameter("purpose");
        String types = request.getParameter("types");
        String times = request.getParameter("times");
        String place = request.getParameter("place");
        String content = request.getParameter("content");
        String arrange = request.getParameter("arrange");
        String a1=null;
        String a2=null;
        if(request.getParameter("a1")!=null)
        {
            a1=request.getParameter("a1")+' ';
        }
        else a1=" ";
        if(request.getParameter("a2")!=null)
        {
            a2=request.getParameter("a2")+' ';
        }
        else a2=" ";

        String object=a1+a2;
        Information B = new Information();
        B.setTheme(theme);
        B.setPurpose(purpose);
        B.setTypes(types);
        B.setTimes(times);
        B.setPlace(place);
        B.setObject(object);
        B.setContent(content);
        B.setArrange(arrange);
        try {
            i= A.add(B);
        } catch (ClassNotFoundException | SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        if(i==1){
            response.sendRedirect("menu.jsp");
        }
        else{
            response.sendRedirect("add01.jsp");
        }

    }

}

add01.jsp

 1 <%--
 2   Created by IntelliJ IDEA.
 3   User: 23944
 4   Date: 2022/10/28
 5   Time: 14:37
 6   To change this template use File | Settings | File Templates.
 7 --%>
 8 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
 9 <!DOCTYPE html>
10 <html>
11 <head>
12     <title>Insert title here</title>
13 </head>
14 <body>
15 <div id="addSubjectForm" align="center">
16     <form action="add" method="post">
17         <tr>
18             <h2>添加活动信息</h2>
19         </tr>
20 
21         <table align="center">
22             <tr>
23                 <td>活动主题</td>
24                 <td>
25                     <input type="text" name="theme">
26                 </td>
27             </tr>
28 
29             <tr>
30                 <td>活动目的</td>
31                 <td>
32                     <input type="text" name="purpose">
33                 </td>
34             </tr>
35 
36             <tr>
37                 <td>活动类型</td>
38                 <td>
39                     <select name="types">
40                         <option value="社团竞赛">社团竞赛</option>
41                         <option value="野外采风">野外采风</option>
42                         <option value="校内集会">校内集会</option>
43                         <option value="社团纳新" selected>社团纳新</option>
44                     </select>
45                 </td>
46             </tr>
47 
48             <tr>
49                 <td>活动时间</td>
50                 <td>
51                     <input type="text" name="times">
52                 </td>
53             </tr>
54 
55             <tr>
56                 <td>活动地点</td>
57                 <td>
58                     <input type="text" name="place">
59                 </td>
60             </tr>
61 
62             <tr>
63                 <td>活动对象</td>
64                 <td>
65                     <input type="checkbox" name="a1" value="社团成员">社团成员 <br>
66                     <input type="checkbox" name="a2" value="全体学生" checked>全体学生<br>
67 
68                 </td>
69             </tr>
70 
71             <tr>
72                 <td>活动内容</td>
73                 <td>
74                     <input type="text" name="content">
75                 </td>
76             </tr>
77 
78             <tr>
79                 <td>活动日程安排</td>
80                 <td>
81                     <input type="text" name="arrange">
82                 </td>
83             </tr>
84 
85             <tr>
86                 <td colspan="2"><div align="center">
87                     <input type="submit" value="提交">
88                 </div>
89                 </td>
90             </tr>
91         </table>
92     </form>
93 </div>
94 
95 </body>
96 <script type="text/javascript">
97 
98 </script>
99 </html>

pom.xml

 

 暂时只放出了添加功能方面的代码,更加详细的代码请见

https://www.cnblogs.com/rsy-bxf150/p/17169979.html

posted @ 2022-11-05 11:53  冰稀饭Aurora  阅读(91)  评论(0编辑  收藏  举报