基于javaweb+jsp的学生考勤管理系统(JavaWeb JSP MySQL Servlet SSM SpringBoot Bootstrap)
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Bootstrap
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可
开发工具:eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
import java.util.Random;
@Controller
public class AuthController extends HttpServlet {
@Autowired
private UserService userService;
@RequestMapping("authLogin")
public void login(HttpServletResponse response, HttpServletRequest request) throws IOException, ServletException {
String username = Util.decode(request, "username");
String password = Util.decode(request, "password");
String validationCode = Util.decode(request, "validationCode");
if (validationCode != null && !validationCode.equals(request.getSession().getAttribute("validationCode"))) {//验证码不通过
request.getSession().setAttribute("alert_msg", "错误:验证码不正确!");
request.getRequestDispatcher("login.jsp").forward(request, response);
return;
}
Map<String, Object> params = new HashMap();
<if test ='userType != null'>`user_type`</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='id != null'>#{id},</if>
<if test ='username != null'>#{username},</if>
<if test ='password != null'>#{password},</if>
<if test ='realName != null'>#{realName},</if>
<if test ='userSex != null'>#{userSex},</if>
<if test ='userPhone != null'>#{userPhone},</if>
<if test ='userText != null'>#{userText},</if>
<if test ='userType != null'>#{userType}</if>
</trim>
</insert>
</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>
this.studentClass = studentClass;
}
public String getStudentPhone() {
return studentPhone;
}
public void setStudentPhone(String studentPhone) {
this.studentPhone = studentPhone;
}
public String getStudentEmail() {
return studentEmail;
}
public void setStudentEmail(String studentEmail) {
this.studentEmail = studentEmail;
}
public String getStudentText() {
<if test ='realName != null'>`real_name` = #{realName},</if>
<if test ='userSex != null'>`user_sex` = #{userSex},</if>
<if test ='userPhone != null'>`user_phone` = #{userPhone},</if>
<if test ='userText != null'>`user_text` = #{userText},</if>
<if test ='userType != null'>`user_type` = #{userType}</if>
</set>
WHERE `id` = #{id}
</update>
<!--获取-->
<select id="findById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" /> FROM `t_user` WHERE `id` = #{id}
</select>
<!--列表-->
<select id="findAllSplit" parameterType="java.util.Map" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" /> FROM `t_user`
<where>
<div class="col-sm-5">
<input name="recordStatus" type="radio" value="正常" checked="checked"/> 正常
<input name="recordStatus" type="radio" value="迟到"/> 迟到
<input name="recordStatus" type="radio" value="早退"/> 早退
<input name="recordStatus" type="radio" value="请假"/> 请假
<input name="recordStatus" type="radio" value="旷课"/> 旷课
<input name="recordStatus" type="radio" value="其它"/> 其它
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">时间:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="recordTime" name="recordTime">
</div>
</div>
<div class="form-group">
<div class="form-group">
<label class="col-sm-3 control-label">邮箱:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="studentEmail" name="studentEmail" value="${vo.studentEmail}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-5">
<textarea rows="3" class="form-control" id="studentText" name="studentText" placeholder="请输入内容......">${vo.studentText}</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-5">
<input type="submit" class="btn btn-pill btn-warning btn-sm" value="保存">
<input type="button" class="btn btn-pill btn-info btn-sm" value="返回" onclick="javascript:history.back(-1);">
</div>
</div>
</form>
</div>
</body>
<script type="text/javascript">
<if test ='recordCourse != null'>`record_course`,</if>
<if test ='recordClass != null'>`record_class`,</if>
<if test ='recordStatus != null'>`record_status`,</if>
<if test ='recordTime != null'>`record_time`,</if>
<if test ='recordText != null'>`record_text`</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='id != null'>#{id},</if>
<if test ='recordName != null'>#{recordName},</if>
<if test ='recordNo != null'>#{recordNo},</if>
<if test ='recordCourse != null'>#{recordCourse},</if>
<if test ='recordClass != null'>#{recordClass},</if>
<if test ='recordStatus != null'>#{recordStatus},</if>
<if test ='recordTime != null'>#{recordTime},</if>
<if test ='recordText != null'>#{recordText}</if>
</trim>
</insert>
<!--批量删除-->
<delete id="doRemoveBatch" parameterType="java.util.Collection">
DELETE FROM `t_record` WHERE `id` IN
<foreach collection="list" item="id" separator="," open="(" close=")">
* @throws IOException
*/
@RequestMapping("userList")
public void list(HttpServletResponse response, HttpServletRequest request) throws IOException {
this.redirectList(request, response);
}
/**
* 跳转到列表页面
*
* @param request
* @param response
*/
private void redirectList(HttpServletRequest request, HttpServletResponse response) throws IOException {
//查询列和关键字
package com.demo.controller;
import com.demo.util.Util;
import com.demo.service.CourseService;
import com.demo.vo.Course;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping
public class CourseController {
@Autowired
private CourseService courseService;
<!--新增-->
<insert id="doCreate" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.demo.vo.User">
INSERT INTO `t_user`
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='id != null'>`id`,</if>
<if test ='username != null'>`username`,</if>
<if test ='password != null'>`password`,</if>
<if test ='realName != null'>`real_name`,</if>
<if test ='userSex != null'>`user_sex`,</if>
<if test ='userPhone != null'>`user_phone`,</if>
<if test ='userText != null'>`user_text`,</if>
<if test ='userType != null'>`user_type`</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='id != null'>#{id},</if>
<if test ='username != null'>#{username},</if>
<if test ='password != null'>#{password},</if>
<if test ='realName != null'>#{realName},</if>
<if test ='userSex != null'>#{userSex},</if>
<if test ='userPhone != null'>#{userPhone},</if>
<if test ='userText != null'>#{userText},</if>
<if test ='userType != null'>#{userType}</if>
</trim>
</insert>
运行环境
Java≥6、Tomcat≥7.0、MySQL≥5.5
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
技术框架
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Bootstrap
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、课程模块、考勤模块、学生模块的增删改查管理