基于javaweb+jsp的学生成绩管理系统(JavaWeb JSP MySQL Servlet SSM SpringBoot Layui Ajax)
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Layui Ajax
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可修改
开发工具:eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
@RequestMapping({"scoreGet", "scoreEditPre"})
public void get(HttpServletResponse response, HttpServletRequest request) throws IOException {
Serializable id = Util.decode(request, "id");//取出主键id
Score vo = scoreService.get(id);
request.getSession().setAttribute("vo", vo);
String to = request.getRequestURI().toLowerCase().contains("get") ? "info" : "edit";//判断是去详情显示页面还是编辑页面
response.sendRedirect("score_" + to + ".jsp");
}
/**
* 根据条件查询成绩的列表并跳转回页面
*
* @param response
* @param request
* @throws IOException
*/
@RequestMapping("scoreList")
public void list(HttpServletResponse response, HttpServletRequest request) throws IOException {
this.redirectList(request, response);
}
/**
* 跳转到列表页面
*
* @param request
* @param response
*/
<input type="text" name="realName" lay-verify="required|realName" class="layui-input" value="${vo.realName}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">性别:</label>
<div class="layui-input-block">
<input name="userSex" type="radio" value="男" ${vo.userSex=='男'?'checked':''} class="layui-input" title="男"/>
<input name="userSex" type="radio" value="女" ${vo.userSex=='女'?'checked':''} class="layui-input" title="女"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手机:</label>
<div class="layui-input-block">
<input type="text" name="userPhone" lay-verify="required|userPhone" class="layui-input" value="${vo.userPhone}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">备注:</label>
}
//@Override
public Notice get(Serializable id) {
return this.noticeMapper.findById(id);
}
//@Override
public Map<String, Object> list(Map<String, Object> params) {
Map<String, Object> resultMap = new HashMap();
resultMap.put("totalCount", this.noticeMapper.getAllCount(params));
resultMap.put("list", this.noticeMapper.findAllSplit(params));
return resultMap;
}
}
package com.demo.service.impl;
import com.demo.dao.ScoreMapper;
import com.demo.service.ScoreService;
import com.demo.vo.Score;
return scoreClass;
}
public void setScoreClass(String scoreClass) {
this.scoreClass = scoreClass;
}
public String getScoreSubject() {
return scoreSubject;
}
public void setScoreSubject(String scoreSubject) {
this.scoreSubject = scoreSubject;
}
public String getScoreTeacher() {
return scoreTeacher;
}
public void setScoreTeacher(String scoreTeacher) {
this.scoreTeacher = scoreTeacher;
}
public String getScoreScore() {
return scoreScore;
}
public void setScoreScore(String scoreScore) {
this.scoreScore = scoreScore;
* @param c
* @return
*/
private static boolean isChinese(char c) {
Character.UnicodeBlock ub = Character.UnicodeBlock.of(c);
return (ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
|| 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();
userService.update(vo);
this.redirectList(request, response);
}
/**
* 获取用户的详细信息(详情页面与编辑页面要显示该用户的详情)并跳转回页面
*
* @param response
* @param request
* @throws IOException
*/
@RequestMapping({"userGet", "userEditPre"})
public void get(HttpServletResponse response, HttpServletRequest request) throws IOException {
Serializable id = Util.decode(request, "id");//取出主键id
User vo = userService.get(id);
request.getSession().setAttribute("vo", vo);
String to = request.getRequestURI().toLowerCase().contains("get") ? "info" : "edit";//判断是去详情显示页面还是编辑页面
response.sendRedirect("user_" + to + ".jsp");
}
</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" />
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
* Notice模块的Service层(业务层)的具体实现类,对NoticeService接口中定义的抽象方法作出具体的功能实现
*/
@Service
public class NoticeServiceImpl implements NoticeService {
@Autowired
// 将验证码保存在session对象中,key为validation_code
session.setAttribute("validationCode", validationCode.toString());
g.dispose();// 关闭Graphics对象
OutputStream os = response.getOutputStream();
ImageIO.write(image, "JPEG", os);// 以JPEG格式向客户端发送图形验证码
}
@RequestMapping("authResetPassword")
public void resetPassword(HttpServletResponse response, HttpServletRequest request) throws IOException, ServletException {
String msg;
User loginUser = (User) request.getSession().getAttribute("loginUser");
String oldPassword = Util.decode(request, "oldPassword");
if (!loginUser.getPassword().equals(oldPassword)) {
msg = "原密码错误!";
} else {
String newPassword = Util.decode(request, "newPassword");
loginUser.setPassword(newPassword);
this.userService.update(loginUser);
msg = "修改成功!";
}
request.getSession().setAttribute("alert_msg", msg);
request.getRequestDispatcher("reset_password.jsp").forward(request, response);
}
// 返回一个随机颜色(Color对象)
private Color getRandomColor(int minColor, int maxColor) {
title: '教师',
},
{
field: 'scoreScore',
title: '分数',
},
{
field: 'scoreText',
title: '备注',
},
{
align: 'center',
fixed: 'right',
title: '操作',
width: 130,
templet: vo => {
let flag = ${loginUser.userType == '管理员'};
return flag ? '<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>' : '';
}
}
]
运行环境
Java≥6、Tomcat≥7.0、MySQL≥5.5
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
技术框架
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Layui Ajax
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可修改
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、成绩模块的增删改查管理