基于javaweb和mysql的ssm教务学生管理成绩管理系统(java+ssm+jsp+jquery+mysql)
·
基于javaweb和mysql的ssm教务学生管理成绩管理系统(java+ssm+jsp+jquery+mysql)
私信源码获取及调试交流
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM教务学生管理成绩管理系统(java+ssm+jsp+jquery+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.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 6.数据库:MySql 5.7等版本均可;
技术栈
- 后端:Spring springmvc mybatis 2. 前端:JSP+css+javascript+jQuery
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2.使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat
model.addAttribute("errMsg", "该信息已存在!");
return "Bnaji/saveOrUpdate";
}
bnajiMapper.insertObject(util);
} else {
if (list.size() > 1) {
model.addAttribute("util", util);
model.addAttribute("errMsg", "该信息已存在!");
return "Bnaji/saveOrUpdate";
}
bnajiMapper.updateObject(util);
}
return this.getAllUtil(request, model);
}
}
@Controller
@RequestMapping(value = "Kemu")
public class KemuController {
@Autowired
private KemuMapper kemuMapper;
@RequestMapping(value = "/initUtil.do")
public String initUtil(HttpServletRequest request, Model model) {
return "Kemu/saveOrUpdate";
}
@RequestMapping(value = "/selectUtil.do")
currentPageNo = Integer.parseInt(pageNo);
}catch(Exception e){
}
List<JiaowuLaoshi> list = jiaowuLaoshiMapper.getObjectList(field, fieldValue);
List<JiaowuLaoshi> listJiaowuLaoshi = new ArrayList<JiaowuLaoshi>();
HttpSession session = request.getSession();
int user_id = (Integer) session.getAttribute("user_id");
String user_type = (String) session.getAttribute("user_type");
for (JiaowuLaoshi temp : list) {
if (user_id == temp.getUser().getId()) {
listJiaowuLaoshi.add(temp);
}
}
if (!"admin".equals(user_type)) {
//list = listJiaowuLaoshi;
}
PageModel pageModel = new PageModel();
pageModel = pageModel.getUtilByController(list, currentPageNo);
model.addAttribute("pageModel", pageModel);
model.addAttribute("fieldValue", fieldValue);
model.addAttribute("field", field);
return "JiaowuLaoshi/find";
}
@RequestMapping(value = "/deleteUtil.do")
public String deleteUtil(HttpServletRequest request, JiaowuLaoshi util, Model model) {
try{
jiaowuLaoshiMapper.deleteObject(util.getId());
}catch(Exception e){
}
return this.getAllUtil(request, model);
}
@RequestMapping(value = "/deleteManyUtil.do")
public String deleteManyUtil(HttpServletRequest request, User util,
Model model) {
String ids[] = request.getParameterValues("id");
for (String id : ids) {
util = new User();
util.setId(Integer.parseInt(id));
try {
fieldValue = new String(fieldValue.getBytes("iso-8859-1"), "utf-8");
} catch (Exception e) {}
String pageNo = request.getParameter("pageModel.currentPageNo");
int currentPageNo = 1;
try{
currentPageNo = Integer.parseInt(pageNo);
}catch(Exception e){
}
List<Student> list = studentMapper.getObjectList(field, fieldValue);
List<Student> listStudent = new ArrayList<Student>();
HttpSession session = request.getSession();
int user_id = (Integer) session.getAttribute("user_id");
String user_type = (String) session.getAttribute("user_type");
for (Student temp : list) {
if (user_id == temp.getUser().getId()) {
listStudent.add(temp);
}
}
if (!"admin".equals(user_type)) {
//list = listStudent;
}
PageModel pageModel = new PageModel();
pageModel = pageModel.getUtilByController(list, currentPageNo);
model.addAttribute("pageModel", pageModel);
model.addAttribute("fieldValue", fieldValue);
model.addAttribute("field", field);
return "Student/find";
}
@RequestMapping(value = "/deleteUtil.do")
public String deleteUtil(HttpServletRequest request, Student util, Model model) {
try{
studentMapper.deleteObject(util.getId());
}catch(Exception e){
}
return this.getAllUtil(request, model);
}
@RequestMapping(value = "/deleteManyUtil.do")
public String deleteManyUtil(HttpServletRequest request, User util,
Model model) {
String ids[] = request.getParameterValues("id");
for (String id : ids) {
util = new User();
@Autowired
private RenkeLaoshiMapper renkeLaoshiMapper;
@Autowired
private UserMapper userMapper;
@Autowired
private BnajiMapper bnajiMapper;
@RequestMapping(value = "/initUtil.do")
public String initUtil(HttpServletRequest request, Model model) {
List<User> listUser = userMapper.getObjectList(null, null);
model.addAttribute("listUser", listUser);
List<Bnaji> listBnaji = bnajiMapper.getObjectList(null, null);
model.addAttribute("listBnaji", listBnaji);
return "RenkeLaoshi/saveOrUpdate";
}
@RequestMapping(value = "/selectUtil.do")
public String selectUtil(HttpServletRequest request, RenkeLaoshi util, Model model) {
util = renkeLaoshiMapper.selectObject(util.getId());
model.addAttribute("util", util);
List<User> listUser = userMapper.getObjectList(null, null);
model.addAttribute("listUser", listUser);
List<Bnaji> listBnaji = bnajiMapper.getObjectList(null, null);
model.addAttribute("listBnaji", listBnaji);
return "RenkeLaoshi/saveOrUpdate";
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value = "/getAllUtil.do")
public String getAllUtil(HttpServletRequest request, Model model) {
String field = request.getParameter("field");
String fieldValue = request.getParameter("fieldValue");
try {
fieldValue = new String(fieldValue.getBytes("iso-8859-1"), "utf-8");
} catch (Exception e) {}
String pageNo = request.getParameter("pageModel.currentPageNo");
int currentPageNo = 1;
try{
currentPageNo = Integer.parseInt(pageNo);
}catch(Exception e){
}
String[] list = this.request.getParameterValues( (String)conf.get( "fieldName" ) );
state = new ImageHunter( conf ).capture( list );
break;
case ActionMap.LIST_IMAGE:
case ActionMap.LIST_FILE:
conf = configManager.getConfig( actionCode );
int start = this.getStartIndex();
state = new FileManager( conf ).listFile( start );
break;
}
return state.toJSONString();
}
public int getStartIndex () {
String start = this.request.getParameter( "start" );
try {
return Integer.parseInt( start );
} catch ( Exception e ) {
return 0;
}
}
/**
* callback参数验证
*/
public boolean validCallbackName ( String name ) {
if ( name.matches( "^[a-zA-Z_]+[\\w0-9_]*$" ) ) {
return true;
}
return false;
}
return new BaseState(false, AppInfo.IO_ERROR);
}
private static boolean validType(String type, String[] allowTypes) {
List<String> list = Arrays.asList(allowTypes);
return list.contains(type);
}
}
@SuppressWarnings("serial")
public class ImageServlet extends HttpServlet {
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
response.setContentType("image/jpeg");
int w = 85;
int h = 20;
java.util.Random random = new java.util.Random();
BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Graphics pen = img.getGraphics();
pen.setColor(Color.WHITE);
pen.fillRect(0, 0, w, h);
for (int i = 0; i < 50; i++) {
pen.setColor(new Color(random.nextInt(255), random.nextInt(255),
random.nextInt(255)));
int x1 = random.nextInt(w);
int y1 = random.nextInt(h);
int x2 = random.nextInt(10) + x1;
int y2 = random.nextInt(10) + y1;
pen.drawLine(x1, y1, x2, y2);
}
StringBuffer sb = new StringBuffer();
pen.setFont(new Font("黑体", Font.BOLD, 16));
for (int i = 0; i < 4; i++) {
pen.setColor(new Color(random.nextInt(100), random.nextInt(100),
random.nextInt(100)));
String num = String.valueOf(random.nextInt(10));
}catch(Exception e){}
}
return this.getAllUtil(request, model);
}
@RequestMapping(value = "/saveOrUpdateObject.do")
public String saveOrUpdateObject(HttpServletRequest request, Bnaji util, Model model) {
List<Bnaji> list = bnajiMapper.getObjectList("s_0", util.getS_0());
if (0 == util.getId()) {
if (list.size() > 0) {
model.addAttribute("util", util);
model.addAttribute("errMsg", "该信息已存在!");
return "Bnaji/saveOrUpdate";
}
bnajiMapper.insertObject(util);
} else {
if (list.size() > 1) {
model.addAttribute("util", util);
model.addAttribute("errMsg", "该信息已存在!");
return "Bnaji/saveOrUpdate";
}
bnajiMapper.updateObject(util);
}
return this.getAllUtil(request, model);
}
}
@Controller
@RequestMapping(value = "Kemu")
public class KemuController {
@Autowired
private KemuMapper kemuMapper;
@RequestMapping(value = "/initUtil.do")
public String initUtil(HttpServletRequest request, Model model) {
return "Kemu/saveOrUpdate";
}
@RequestMapping(value = "/selectUtil.do")
public String selectUtil(HttpServletRequest request, Kemu util, Model model) {
util = kemuMapper.selectObject(util.getId());
model.addAttribute("util", util);
@Controller
@RequestMapping(value = "Bnaji")
public class BnajiController {
@Autowired
private BnajiMapper bnajiMapper;
@RequestMapping(value = "/initUtil.do")
public String initUtil(HttpServletRequest request, Model model) {
return "Bnaji/saveOrUpdate";
}
@RequestMapping(value = "/selectUtil.do")
public String selectUtil(HttpServletRequest request, Bnaji util, Model model) {
util = bnajiMapper.selectObject(util.getId());
model.addAttribute("util", util);
return "Bnaji/saveOrUpdate";
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value = "/getAllUtil.do")
public String getAllUtil(HttpServletRequest request, Model model) {
String field = request.getParameter("field");
String fieldValue = request.getParameter("fieldValue");
try {
fieldValue = new String(fieldValue.getBytes("iso-8859-1"), "utf-8");
} catch (Exception e) {}
String pageNo = request.getParameter("pageModel.currentPageNo");
int currentPageNo = 1;
try{
currentPageNo = Integer.parseInt(pageNo);
}catch(Exception e){
}
List<Bnaji> list = bnajiMapper.getObjectList(field, fieldValue);
PageModel pageModel = new PageModel();
pageModel = pageModel.getUtilByController(list, currentPageNo);
model.addAttribute("pageModel", pageModel);
model.addAttribute("fieldValue", fieldValue);
model.addAttribute("field", field);
return "Bnaji/find";
}
List<Kemu> listKemu = kemuMapper.getObjectList(null, null);
model.addAttribute("listKemu", listKemu);
return "Chengji/saveOrUpdate";
}
@RequestMapping(value = "/selectUtil.do")
public String selectUtil(HttpServletRequest request, Chengji util, Model model) {
util = chengjiMapper.selectObject(util.getId());
model.addAttribute("util", util);
List<Student> listStudent = studentMapper.getObjectList(null, null);
model.addAttribute("listStudent", listStudent);
List<Kemu> listKemu = kemuMapper.getObjectList(null, null);
model.addAttribute("listKemu", listKemu);
return "Chengji/saveOrUpdate";
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value = "/getAllUtil.do")
public String getAllUtil(HttpServletRequest request, Model model) {
String field = request.getParameter("field");
String fieldValue = request.getParameter("fieldValue");
try {
fieldValue = new String(fieldValue.getBytes("iso-8859-1"), "utf-8");
} catch (Exception e) {}
String pageNo = request.getParameter("pageModel.currentPageNo");
int currentPageNo = 1;
try{
currentPageNo = Integer.parseInt(pageNo);
}catch(Exception e){
}
List<Chengji> list = chengjiMapper.getObjectList(field, fieldValue);
PageModel pageModel = new PageModel();
pageModel = pageModel.getUtilByController(list, currentPageNo);
model.addAttribute("pageModel", pageModel);
model.addAttribute("fieldValue", fieldValue);
model.addAttribute("field", field);
return "Chengji/find";
}
@RequestMapping(value = "/deleteUtil.do")
public String deleteUtil(HttpServletRequest request, Chengji util, Model model) {
try{
chengjiMapper.deleteObject(util.getId());
}catch(Exception e){
}
return this.getAllUtil(request, model);
model.addAttribute("pageModel", pageModel);
model.addAttribute("fieldValue", fieldValue);
model.addAttribute("field", field);
return "Student/find";
}
@RequestMapping(value = "/deleteUtil.do")
public String deleteUtil(HttpServletRequest request, Student util, Model model) {
try{
studentMapper.deleteObject(util.getId());
}catch(Exception e){
}
return this.getAllUtil(request, model);
}
@RequestMapping(value = "/deleteManyUtil.do")
public String deleteManyUtil(HttpServletRequest request, User util,
Model model) {
String ids[] = request.getParameterValues("id");
for (String id : ids) {
util = new User();
util.setId(Integer.parseInt(id));
try{
studentMapper.deleteObject(util.getId());
}catch(Exception e){}
}
return this.getAllUtil(request, model);
}
@RequestMapping(value = "/saveOrUpdateObject.do")
public String saveOrUpdateObject(HttpServletRequest request, Student util, Model model) {
List<Student> list = studentMapper.getObjectList("s_0", util.getS_0());
List<User> listUser = userMapper.getObjectList(null, null);
model.addAttribute("listUser", listUser);
List<Bnaji> listBnaji = bnajiMapper.getObjectList(null, null);
model.addAttribute("listBnaji", listBnaji);
if (0 == util.getId()) {
if (list.size() > 0) {
model.addAttribute("util", util);
model.addAttribute("errMsg", "该信息已存在!");
return "Student/saveOrUpdate";
}
studentMapper.insertObject(util);
} else {
if (list.size() > 1) {
model.addAttribute("util", util);
model.addAttribute("errMsg", "该信息已存在!");
return "Student/saveOrUpdate";
}
studentMapper.updateObject(util);
try {
fieldValue = new String(fieldValue.getBytes("iso-8859-1"), "utf-8");
} catch (Exception e) {}
String pageNo = request.getParameter("pageModel.currentPageNo");
int currentPageNo = 1;
try{
currentPageNo = Integer.parseInt(pageNo);
}catch(Exception e){
}
List<Kemu> list = kemuMapper.getObjectList(field, fieldValue);
PageModel pageModel = new PageModel();
pageModel = pageModel.getUtilByController(list, currentPageNo);
model.addAttribute("pageModel", pageModel);
model.addAttribute("fieldValue", fieldValue);
model.addAttribute("field", field);
return "Kemu/find";
}
@RequestMapping(value = "/deleteUtil.do")
public String deleteUtil(HttpServletRequest request, Kemu util, Model model) {
try{
kemuMapper.deleteObject(util.getId());
}catch(Exception e){
}
return this.getAllUtil(request, model);
}
@RequestMapping(value = "/deleteManyUtil.do")
public String deleteManyUtil(HttpServletRequest request, User util,
Model model) {
String ids[] = request.getParameterValues("id");
for (String id : ids) {
util = new User();
util.setId(Integer.parseInt(id));
try{
kemuMapper.deleteObject(util.getId());
}catch(Exception e){}
}
return this.getAllUtil(request, model);
}
@RequestMapping(value = "/saveOrUpdateObject.do")
public String saveOrUpdateObject(HttpServletRequest request, Kemu util, Model model) {
List<Kemu> list = kemuMapper.getObjectList("s_0", util.getS_0());
if (0 == util.getId()) {
if (list.size() > 0) {
model.addAttribute("util", util);
/**
* callback参数验证
*/
public boolean validCallbackName ( String name ) {
if ( name.matches( "^[a-zA-Z_]+[\\w0-9_]*$" ) ) {
return true;
}
return false;
}
}
public class BinaryUploader {
public static final State save(HttpServletRequest request,
Map<String, Object> conf) {
FileItemStream fileStream = null;
boolean isAjaxUpload = request.getHeader( "X_Requested_With" ) != null;
if (!ServletFileUpload.isMultipartContent(request)) {
return new BaseState(false, AppInfo.NOT_MULTIPART_CONTENT);
public String upload(@RequestParam MultipartFile[] myfiles,
HttpServletRequest request, User util, Model model)
throws IOException {
for (MultipartFile file : myfiles) {
if (!file.isEmpty()) {
String fileName = file.getOriginalFilename();
String path = request.getSession().getServletContext()
.getRealPath("image")
+ File.separator;
String uploadName = new SimpleDateFormat("yyyyMMddHHmmss")
.format(new Date()) + fileName;
File localFile = new File(path + uploadName);
file.transferTo(localFile);
util.setS_0(uploadName);
util.setS_1(fileName);
util.setS_2(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.format(new Date()));
}
if (0 == util.getId()) {
userMapper.insertObject(util);
} else {
userMapper.updateObject(util);
}
return this.getAllUtil(request, util, model);
}
return this.getAllUtil(request, util, model);
}
}
model.addAttribute("util", util);
List<User> listUser = userMapper.getObjectList(null, null);
model.addAttribute("listUser", listUser);
return "JiaowuLaoshi/saveOrUpdate";
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value = "/getAllUtil.do")
public String getAllUtil(HttpServletRequest request, Model model) {
String field = request.getParameter("field");
String fieldValue = request.getParameter("fieldValue");
try {
fieldValue = new String(fieldValue.getBytes("iso-8859-1"), "utf-8");
} catch (Exception e) {}
String pageNo = request.getParameter("pageModel.currentPageNo");
int currentPageNo = 1;
try{
currentPageNo = Integer.parseInt(pageNo);
}catch(Exception e){
}
List<JiaowuLaoshi> list = jiaowuLaoshiMapper.getObjectList(field, fieldValue);
List<JiaowuLaoshi> listJiaowuLaoshi = new ArrayList<JiaowuLaoshi>();
HttpSession session = request.getSession();
int user_id = (Integer) session.getAttribute("user_id");
String user_type = (String) session.getAttribute("user_type");
for (JiaowuLaoshi temp : list) {
if (user_id == temp.getUser().getId()) {
listJiaowuLaoshi.add(temp);
}
}
if (!"admin".equals(user_type)) {
//list = listJiaowuLaoshi;
}
PageModel pageModel = new PageModel();
pageModel = pageModel.getUtilByController(list, currentPageNo);
model.addAttribute("pageModel", pageModel);
model.addAttribute("fieldValue", fieldValue);
model.addAttribute("field", field);
return "JiaowuLaoshi/find";
}
public class ActionEnter {
private HttpServletRequest request = null;
private String rootPath = null;
private String contextPath = null;
private String actionType = null;
private ConfigManager configManager = null;
public ActionEnter ( HttpServletRequest request, String rootPath ) {
this.request = request;
this.rootPath = rootPath;
this.actionType = request.getParameter( "action" );
this.contextPath = request.getContextPath();
this.configManager = ConfigManager.getInstance( this.rootPath, this.contextPath, request.getRequestURI() );
}
public String exec () {
String callbackName = this.request.getParameter("callback");
if ( callbackName != null ) {
if ( !validCallbackName( callbackName ) ) {
return new BaseState( false, AppInfo.ILLEGAL ).toJSONString();
}
return callbackName+"("+this.invoke()+");";
} else {
return this.invoke();
}
return true;
}
return false;
}
}
public class BinaryUploader {
public static final State save(HttpServletRequest request,
Map<String, Object> conf) {
FileItemStream fileStream = null;
boolean isAjaxUpload = request.getHeader( "X_Requested_With" ) != null;
if (!ServletFileUpload.isMultipartContent(request)) {
return new BaseState(false, AppInfo.NOT_MULTIPART_CONTENT);
}
ServletFileUpload upload = new ServletFileUpload(
new DiskFileItemFactory());
if ( isAjaxUpload ) {
@Controller
@RequestMapping(value = "RenkeLaoshi")
public class RenkeLaoshiController {
@Autowired
private RenkeLaoshiMapper renkeLaoshiMapper;
@Autowired
private UserMapper userMapper;
@Autowired
private BnajiMapper bnajiMapper;
@RequestMapping(value = "/initUtil.do")
public String initUtil(HttpServletRequest request, Model model) {
List<User> listUser = userMapper.getObjectList(null, null);
model.addAttribute("listUser", listUser);
List<Bnaji> listBnaji = bnajiMapper.getObjectList(null, null);
model.addAttribute("listBnaji", listBnaji);
return "RenkeLaoshi/saveOrUpdate";
}
@RequestMapping(value = "/selectUtil.do")
public String selectUtil(HttpServletRequest request, RenkeLaoshi util, Model model) {
util = renkeLaoshiMapper.selectObject(util.getId());
model.addAttribute("util", util);
List<User> listUser = userMapper.getObjectList(null, null);
model.addAttribute("listUser", listUser);
List<Bnaji> listBnaji = bnajiMapper.getObjectList(null, null);
model.addAttribute("listBnaji", listBnaji);
return "RenkeLaoshi/saveOrUpdate";
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value = "/getAllUtil.do")
public String getAllUtil(HttpServletRequest request, Model model) {
String field = request.getParameter("field");
String fieldValue = request.getParameter("fieldValue");
try {
fieldValue = new String(fieldValue.getBytes("iso-8859-1"), "utf-8");
} catch (Exception e) {}
String pageNo = request.getParameter("pageModel.currentPageNo");
int currentPageNo = 1;
try{
currentPageNo = Integer.parseInt(pageNo);
}catch(Exception e){
}
List<RenkeLaoshi> list = renkeLaoshiMapper.getObjectList(field, fieldValue);
List<RenkeLaoshi> listRenkeLaoshi = new ArrayList<RenkeLaoshi>();
HttpSession session = request.getSession();
int user_id = (Integer) session.getAttribute("user_id");
String user_type = (String) session.getAttribute("user_type");
for (RenkeLaoshi temp : list) {
if (user_id == temp.getUser().getId()) {
return new BaseState(false, AppInfo.NOT_ALLOW_FILE_TYPE);
}
savePath = PathFormat.parse(savePath, originFileName);
String physicalPath = (String) conf.get("rootPath") + savePath;
InputStream is = fileStream.openStream();
State storageState = StorageManager.saveFileByInputStream(is,
physicalPath, maxSize);
is.close();
if (storageState.isSuccess()) {
storageState.putInfo("url", PathFormat.format(savePath));
storageState.putInfo("type", suffix);
storageState.putInfo("original", originFileName + suffix);
}
return storageState;
} catch (FileUploadException e) {
return new BaseState(false, AppInfo.PARSE_REQUEST_ERROR);
} catch (IOException e) {
}
return new BaseState(false, AppInfo.IO_ERROR);
}
private static boolean validType(String type, String[] allowTypes) {
List<String> list = Arrays.asList(allowTypes);
return list.contains(type);
}
}
@SuppressWarnings("serial")
public class ImageServlet extends HttpServlet {
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
response.setContentType("image/jpeg");
int w = 85;
int h = 20;
java.util.Random random = new java.util.Random();






更多推荐



所有评论(0)