基于javaweb的JSP+Servlet高校社团信息管理系统(java+jsp+html+javascript+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

080023442402

090023442402

110023442402

120023442402

130023442402

140023442402

基于javaweb的JSP+Servlet高校社团信息管理系统(java+jsp+html+javascript+mysql)

项目介绍

管理员角色包含以下功能: 管理员登录,用户信息管理,社团创建审批,社团简介管理,学校器材管理,图片资讯查询,活动消息管理,新闻资讯管理,留言信息查询等功能。

社团管理员角色包含以下功能: 社团管理员登录,我的社团信息查询,社团成员查询,社团活动管理,社团新闻管理等功能。

用户角色包含以下功能: 查看所有新闻,用户注册,查看新闻,留言板留言,查看活动信息,创建社团,查看社团详细情况,申请加入社团,个人信息修改,创建社团审批详情,加入社团审批详情等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;  5.数据库:MySql 5.7版本;

技术栈

HTML+CSS+JavaScript+jsp+mysql

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/login.jsp 登录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
        <tr>
<td align="right" style="padding-right:5px">活动经费:</td>
<td>
<s:textfield cssStyle="width:345px;" name="paramsActivity.activity_money" id="paramsActivity.activity_money" value="%{#attr.activity.activity_money}"/>
</td>
</tr>
<tr>
<td align="right" style="padding-right:5px">活动内容:</td>
<td>
<textarea style="width:350px;height:250px" name="paramsActivity.activity_content" id="noticeContent"><s:property value="#attr.activity.activity_content" escape="false"/></textarea>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" align="center" cellpadding="0" cellspacing="0" class="editbody">
<tr class="editbody">
<td align="center" height="30">
<s:if test="#attr.activity!=null && #attr.activity.activity_id!=0">
<input type="button" id="editBtn" Class="btnstyle" value="编 辑"/>
</s:if>
<s:else>
<input type="button" id="addBtn" Class="btnstyle" value="添 加" />
</s:else>
&nbsp;<label style="color:red">${tip}</label>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<script>
KE.show({
id : 'noticeContent',
items:['source', '|','plainpaste', '|', 'selectall', 'bold','italic'],
resizeMode:1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
public String addNews(){
try {
//用户身份判断
User admin = (User) Param.getSession("admin");
paramsNews.setUser_id(admin.getUser_id());
if (admin.getUser_type()==2) {
//社团新闻需审核
paramsNews.setNews_flag(1);
//社团新闻
paramsNews.setNews_type(1);
}else {
//校园新闻无需审核
paramsNews.setNews_flag(2);
//校园新闻
paramsNews.setNews_type(2);
}
//添加新闻资讯
adminManager.addNews(paramsNews);

} catch (Exception e) {
setErrorTip("添加新闻异常", "Admin_listNewss.action");
}
setSuccessTip("添加成功", "Admin_listNewss.action");
return "infoTip";
}


/**
* @Title: editNews
* @Description: 编辑新闻资讯
* @return String
*/
public String editNews(){
try {
//得到新闻资讯
News news = adminManager.getNews(paramsNews);
Param.setAttribute("news", news);

} catch (Exception e) {
setErrorTip("查询新闻异常", "Admin_listNewss.action");
return "infoTip";
}

return "newsEdit";
}

/**
* @Title: saveNews
* @Description: 保存编辑新闻资讯
* @return String
*/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
public String listColleges(){
try {
if (paramsCollege==null) {
paramsCollege = new College();
}
//设置分页信息
setPagination(paramsCollege);
//社长身份设置
User admin = (User)Param.getSession("admin");
paramsCollege.setUser_id(admin.getUser_id());
int[] sum={0};
List<College> colleges = adminManager.listColleges(paramsCollege,sum);

Param.setAttribute("colleges", colleges);
setTotalCount(sum[0]);

} catch (Exception e) {
setErrorTip("查询社团异常", "main.jsp");
return "infoTip";
}

return "collegeShow";
}


/**
* @Title: editCollege
* @Description: 编辑社团
* @return String
*/
public String editCollege(){
try {
//得到社团
College college = adminManager.getCollege(paramsCollege);
Param.setAttribute("college", college);

} catch (Exception e) {
setErrorTip("查询社团异常", "Admin_listColleges.action");
return "infoTip";
}

return "collegeEdit";
}

/**
* @Title: saveCollege
* @Description: 保存编辑社团
* @return String
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
 * @param errorMsg
* @return void
*/
protected void setErrorReason(String errorMsg) {
if (errorReason == null) {
errorReason = new HashMap<Object, Object>();
}

setSuccess(false);
this.errorReason.put(ERROR_MSG, errorMsg);
this.errorReason.put(ERROR_STACK, "");
}

protected void setErrorReason(String errorMsg, Exception e) {
if (errorReason == null) {
errorReason = new HashMap<Object, Object>();
}

setSuccess(false);
this.errorReason.put(ERROR_MSG, errorMsg);
this.errorReason.put(ERROR_STACK, generateStackTrace(e));
}

/**
* @Title: generateStackTrace
* @Description: 生成异常堆栈字符串
* @param e
* @return
* @return String
*/
private String generateStackTrace(Exception e) {
if (e == null) {
return null;
}
StringBuffer stringBuffer = new StringBuffer();
ByteArrayOutputStream byteArrayOutputStream = null;
try {
byteArrayOutputStream = new ByteArrayOutputStream();
e.printStackTrace(new PrintStream(byteArrayOutputStream));
stringBuffer.append(byteArrayOutputStream.toString());
} catch (Exception ex) {
} finally {
if (byteArrayOutputStream != null) {
try {
byteArrayOutputStream.close();
} catch (IOException ex2) {
}
}
}
return stringBuffer.toString();
}

public boolean isSuccess() {
return success;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
	ActionContext ctx = ActionContext.getContext();
Map session = ctx.getSession();
session.put(key, value);
}
/**
* 模拟request.getSession().getAttribute(String key)
* @param key
* @param value
*/
public static Object getSession(String key) {
ActionContext ctx = ActionContext.getContext();
Map session = ctx.getSession();
return session.get(key);
}
/**
* 模拟session销毁key
* @param key
*/
public static void removeSession(String key) {
ActionContext ctx = ActionContext.getContext();
Map session = ctx.getSession();
if(session.containsKey(key))
{
session.remove(key);
}
}
/**
* 模拟session销毁
*/
public static void clearSession() {
ActionContext ctx = ActionContext.getContext();
Map session = ctx.getSession();
session.clear();
}
/**
* 模拟application.setAttribute(String key, Object value)
* @param key
* @param value
*/
public static void setApplication(String key, Object value) {
ActionContext ctx = ActionContext.getContext();
Map application = ctx.getApplication();
application.put(key, value);
}
/**
* 模拟application.getAttribute(String key)
* @param key
* @param value
*/
public static Object getApplication(String key) {
ActionContext ctx = ActionContext.getContext();


项目链接:
https://javayms.github.io?id=311122542008200ss
https://javayms.pages.dev?id=311122542008200ss