基于javaweb+jsp的学生会社团管理系统(JavaWeb JSP MySQL Servlet SSM SpringBoot Bootstrap Ajax)
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Bootstrap Ajax
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可修改
开发工具:eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
alert("姓名不能为空");
return false;
}
if (document.getElementById("add-xueshengBumeng").value.trim().length == 0) {
alert("所属会社不能为空");
return false;
}
if (document.getElementById("add-xueshengZhiwei").value.trim().length == 0) {
alert("担任职位不能为空");
return false;
}
return true;
}
<button type="button" class="btn btn-line btn-rect btn-danger" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-line btn-rect btn-warning">提交</button>
</div>
</form>
</div>
</div>
</div>
<!-- delete -->
<div class="modal fade" id="modal-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form action="xueshengDelete">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
if (val == vo.userSex) {
modal.find('#edit-userSex_' + vo.userSex).prop("checked", true);
} else {
modal.find('#edit-userSex_' + vo.userSex).removeAttr("checked");
}
};
modal.find('#edit-userPhone').val(vo.userPhone);
modal.find('#edit-userText').val(vo.userText);
for (let val of "管理员/普通用户".split('/')) {
if (val == vo.userType) {
modal.find('#edit-userType_' + vo.userType).prop("checked", true);
} else {
modal.find('#edit-userType_' + vo.userType).removeAttr("checked");
}
};
}
})
})
$('#modal-info').on('show.bs.modal', function (event) {
let button = $(event.relatedTarget);
let id = button.data('id');
let modal = $(this);
$.ajax({
url: 'userGet?id=' + id,
*/
private void redirectList(HttpServletRequest request, HttpServletResponse response) throws IOException {
//查询列和关键字
String searchColumn = Util.decode(request, "searchColumn");
String keyword = Util.decode(request, "keyword");
Map<String, Object> params = new HashMap();//用来保存控制层传进来的参数(查询条件)
params.put("searchColumn", searchColumn);//要查询的列
params.put("keyword", keyword);//查询的关键字
Map<String, Object> map = huodongService.list(params);
request.getSession().setAttribute("list", map.get("list"));
Integer totalRecord = (Integer) map.get("totalCount");//根据查询条件取出对应的总记录数,用于分页
String pageNum = Util.decode(request, "pageNum");//封装分页参数
com.demo.util.PageBean<Object> pb = new com.demo.util.PageBean(Integer.valueOf(pageNum != null ? pageNum : "1"), totalRecord);
params.put("startIndex", pb.getStartIndex());
params.put("pageSize", pb.getPageSize());
List list = (List) huodongService.list(params).get("list");//根据分页参数startIndex、pageSize查询出来的最终结果list
pb.setServlet("huodongList");
pb.setSearchColumn(searchColumn);
pb.setKeyword(keyword);
<if test ='id != null'>#{id},</if>
<if test ='bumengName != null'>#{bumengName},</if>
<if test ='bumengBuzhang != null'>#{bumengBuzhang},</if>
<if test ='bumengDianhua != null'>#{bumengDianhua},</if>
<if test ='bumengRenshu != null'>#{bumengRenshu},</if>
<if test ='bumengText != null'>#{bumengText}</if>
</trim>
</insert>
<!--批量删除-->
<delete id="doRemoveBatch" parameterType="java.util.Collection">
DELETE FROM `t_bumeng` WHERE `id` IN
<foreach collection="list" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</delete>
response.sendRedirect("login.jsp");
return false;
}
return true;
}
//@Override
public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {
}
//@Override
public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
}
}
package com.demo.vo;
import java.io.Serializable;
/**
* 用户(t_user表对应的Java实体类)
*/
public class User implements Serializable {
private Long id;//主键
private String username;//用户名
private String password;//密码
import javax.imageio.ImageIO;
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 java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
@Controller
public class AuthController extends HttpServlet {
@Autowired
//根据ID获取值
if (document.getElementById("add-username").value.trim().length == 0) {
alert("用户名不能为空");
return false;
}
if (document.getElementById("add-password").value.trim().length == 0) {
alert("密码不能为空");
return false;
}
if (document.getElementById("add-realName").value.trim().length == 0) {
alert("姓名不能为空");
return false;
}
if (document.getElementById("add-userPhone").value.trim().length == 0) {
alert("手机不能为空");
return false;
if (document.getElementById("add-realName").value.trim().length == 0) {
alert("姓名不能为空");
return false;
}
if (document.getElementById("add-userPhone").value.trim().length == 0) {
alert("手机不能为空");
return false;
}
return true;
}
//编辑表单提交之前进行检查,如果return false,则不允许提交
function editCheck() {
//根据ID获取值
if (document.getElementById("edit-username").value.trim().length == 0) {
alert("用户名不能为空");
<if test="startIndex != null and pageSize != null">
LIMIT #{startIndex},#{pageSize};
</if>
</select>
<!--数量-->
<select id="getAllCount" parameterType="java.util.Map" resultType="Integer">
SELECT COUNT(*) FROM `t_bumeng`
<where>
<if test="searchColumn != null and searchColumn != '' and keyword != null and keyword != ''">
${searchColumn} LIKE CONCAT('%',#{keyword},'%') AND
</if>
1=1
</where>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.demo.dao.NoticeMapper">
<resultMap id="BaseResultMap" type="com.demo.vo.Notice" >
<result column="id" property="id" />
<result column="notice_name" property="noticeName" />
<result column="notice_text" property="noticeText" />
<result column="notice_type" property="noticeType" />
<result column="create_date" property="createDate" />
public void edit(HttpServletResponse response, HttpServletRequest request) throws IOException {
Xuesheng vo = new Xuesheng();
vo.setId(Long.valueOf(Util.decode(request, "id")));
vo.setXueshengName(Util.decode(request, "xueshengName"));
vo.setXueshengSex(Util.decode(request, "xueshengSex"));
vo.setXueshengBumeng(Util.decode(request, "xueshengBumeng"));
vo.setXueshengZhiwei(Util.decode(request, "xueshengZhiwei"));
vo.setXueshengText(Util.decode(request, "xueshengText"));
xueshengService.update(vo);
this.redirectList(request, response);
}
/**
* 获取学生的详细信息(详情页面与编辑页面要显示该学生的详情)并跳转回页面
*
* @param response
* @param request
* @throws IOException
*/
@RequestMapping({"xueshengGet", "xueshengEditPre"})
public void get(HttpServletResponse response, HttpServletRequest request) throws IOException {
Serializable id = Util.decode(request, "id");//取出主键id
Xuesheng vo = xueshengService.get(id);
response.getWriter().println(com.alibaba.fastjson.JSONObject.toJSONString(vo));
运行环境
Java≥6、Tomcat≥7.0、MySQL≥5.5
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
技术框架
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Bootstrap Ajax
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可修改
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、会社模块、活动模块、学生模块的增删改查管理