基于javaweb+jsp的学生考勤管理系统(带报告文档)
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等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
@Autowired
private CourseService courseService;
/**
* 增加课程
*
* @param response
* @param request
* @throws IOException
*/
@RequestMapping("courseAdd")
public void add(HttpServletResponse response, HttpServletRequest request) throws IOException {
Course vo = new Course();
//取出页面传进来的参数
vo.setCourseName(Util.decode(request, "courseName"));
vo.setCourseTeacher(Util.decode(request, "courseTeacher"));
vo.setCourseYear(Util.decode(request, "courseYear"));
vo.setCourseTime(Util.decode(request, "courseTime"));
//调用Service层的增加(insert)方法
courseService.insert(vo);
this.redirectList(request, response);
}
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) studentService.list(params).get("list");//根据分页参数startIndex、pageSize查询出来的最终结果list
pb.setServlet("studentList");
pb.setSearchColumn(searchColumn);
pb.setKeyword(keyword);
pb.setList(list);
request.getSession().setAttribute("pageBean", pb);
request.getSession().setAttribute("list", pb.getList());
response.sendRedirect("student_list.jsp");
}
/**
* 学生(t_student表对应的Java实体类)
*/
public class Student implements Serializable {
private Long id;//主键
private String studentNo;//学号
private String studentName;//姓名
private String studentSex;//性别:男/女
private String studentClass;//所属班级
private String studentPhone;//电话
private String studentEmail;//邮箱
private String studentText;//备注
public Long getId() {
vo.setUserType(Util.decode(request, "userType"));
//调用Service层的增加(insert)方法
userService.insert(vo);
this.redirectList(request, response);
}
/**
* 删除用户
*
* @param response
* @param request
* @throws IOException
*/
|| ub == Character.UnicodeBlock.GENERAL_PUNCTUATION
|| ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION
|| ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS);
}
/**
* 判断字符串是否是乱码
*
* @param strName
* @return
*/
public static boolean isMessyCode(String strName) {
java.util.regex.Pattern p = java.util.regex.Pattern.compile("\\s*|\t*|\r*|\n*");
java.util.regex.Matcher m = p.matcher(strName);
String after = m.replaceAll("");
String temp = after.replaceAll("\\p{P}", "");
char[] ch = temp.trim().toCharArray();
float chLength = 0;
float count = 0;
for (int i = 0; i < ch.length; i++) {
char c = ch[i];
if (!Character.isLetterOrDigit(c)) {
if (!isChinese(c)) {
count = count + 1;
}
chLength++;
}
vo.setId(Long.valueOf(Util.decode(request, "id")));
vo.setNoticeName(Util.decode(request, "noticeName"));
vo.setNoticeText(Util.decode(request, "noticeText"));
vo.setNoticeType(Util.decode(request, "noticeType"));
vo.setCreateDate(Util.decode(request, "createDate"));
noticeService.update(vo);
this.redirectList(request, response);
}
/**
* 获取公告的详细信息(详情页面与编辑页面要显示该公告的详情)并跳转回页面
*
* @param response
* @param request
* @throws IOException
*/
@RequestMapping({"noticeGet", "noticeEditPre"})
public void get(HttpServletResponse response, HttpServletRequest request) throws IOException {
Serializable id = Util.decode(request, "id");//取出主键id
Notice vo = noticeService.get(id);
response.getWriter().println(com.alibaba.fastjson.JSONObject.toJSONString(vo));
</div>
<div class="modal-footer">
<button type="button" class="btn btn-rect btn-grad btn-warning" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-rect btn-grad btn-warning">提交</button>
</div>
</form>
</div>
</div>
</div>
<!-- info -->
<div class="modal fade" id="modal-info" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">课程</h4>
</div>
`id`,`student_no`,`student_name`,`student_sex`,`student_class`,`student_phone`,`student_email`,`student_text`
</sql>
<!--新增-->
<insert id="doCreate" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.demo.vo.Student">
INSERT INTO `t_student`
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='id != null'>`id`,</if>
<if test ='studentNo != null'>`student_no`,</if>
<if test ='studentName != null'>`student_name`,</if>
<if test ='studentSex != null'>`student_sex`,</if>
<if test ='studentClass != null'>`student_class`,</if>
<if test ='studentPhone != null'>`student_phone`,</if>
<if test ='studentEmail != null'>`student_email`,</if>
<if test ='studentText != null'>`student_text`</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='id != null'>#{id},</if>
<if test ='studentNo != null'>#{studentNo},</if>
<if test ='studentName != null'>#{studentName},</if>
<if test ='studentSex != null'>#{studentSex},</if>
<if test ='studentClass != null'>#{studentClass},</if>
<if test ='studentPhone != null'>#{studentPhone},</if>
<if test ='studentEmail != null'>#{studentEmail},</if>
<if test ='studentText != null'>#{studentText}</if>
</trim>
<div class="modal-body">
确认要删除该公告记录吗?
<div class="form-group hidden">
<label class="control-label">(hidden)</label>
<input type="hidden" class="form-control" name="action" value="delete">
<input type="text" class="form-control" name="id" id="delete-id">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-rect btn-grad btn-warning" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-rect btn-grad btn-primary">删除</button>
</div>
</form>
</div>
</div>
</div>
</body>
<script>
$('#modal-delete').on('show.bs.modal', function (event) {
let button = $(event.relatedTarget);
let id = button.data('id');
let modal = $(this);
modal.find('#delete-id').val(id);
})
</c:otherwise>
</c:choose>
</td>
<th style="text-align: center;">
<button class="btn btn-rect btn-grad btn-default btn-sm" data-id="${vo.id}"
data-toggle="modal" data-target="#modal-info">详情
</button>
<button class="btn btn-rect btn-grad btn-warning btn-sm"
<c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if>
data-id="${vo.id}"
data-toggle="modal" data-target="#modal-edit">编辑
</button>
<button class="btn btn-rect btn-grad btn-primary btn-sm" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> data-id="${vo.id}"
data-toggle="modal" data-target="#modal-delete">删除
</button>
</th>
</tr>
</c:forEach>
</tbody>
</table>
</div>
<div style="float: right;padding-right: 10px;color: #515151;"><jsp:include page="split.jsp"/></div>
</div>
</div>
运行环境
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…均可修改
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、课程模块、考勤模块、学生模块的增删改查管理