Java项目:SSH学生请假管理系统

作者主页:夜未央5788

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

本项目分为管理员、教师、学生三种角色;

教师角色包含以下功能:

教师角色登录,请假查看,审批学生请假,学生管理等功能。

管理员角色包含以下功能:
班级管理,班主任管理,公告管理,留言板管理,学生管理等功能。

学生角色包含以下功能:
学生登录,留言板,请假申请,我的请假等功能。

环境需要

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.数据库:MySql 5.7版本;

6.是否Maven项目:否;

技术栈

1. 后端:mysql+Spring+Struts+Hibernate

2. 前端:JSP+CSS+JavaScript+jquery

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中config/jdbc.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入http://localhost:8080/ 登录
管理员账号/密码:admin/admin
教师账号/密码: teacher/123456

学生账号/密码: student/123456

运行截图

管理员角色

 

 

教师角色 

 

 

 

学生角色 

 

 

 

 

 

相关代码 

loginAction

package com.xznu.edu.leave.action;
/**
 * 和登陆有关的都在这里
 */

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.xznu.edu.leave.dao.ManageDao;
import com.xznu.edu.leave.model.ClassRoom;
import com.xznu.edu.leave.model.Comment;
import com.xznu.edu.leave.model.Manage;
import com.xznu.edu.leave.model.NoticeInfo;
import com.xznu.edu.leave.model.Student;
import com.xznu.edu.leave.service.ClassRoomService;
import com.xznu.edu.leave.service.CommentService;
import com.xznu.edu.leave.service.ManageService;
import com.xznu.edu.leave.service.NoticeInfoService;
import com.xznu.edu.leave.service.StudentService;
import com.xznu.edu.leave.utils.TimeSetUtil;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

@Controller("loginAction")
@Scope("prototype")
public class LoginAction extends ActionSupport {
	@Autowired
	private CommentService commentService;
	@Autowired
	private ManageService manageService;
	@Autowired
	private StudentService studentService;
	@Autowired
	private NoticeInfoService noticeInfoService;
	@Autowired
	private ClassRoomService classRoomService;

	private int mid;
	private int sid;
	public int getMid() {
		return mid;
	}
	public void setMid(int mid) {
		this.mid = mid;
	}
	public int getSid() {
		return sid;
	}
	public void setSid(int sid) {
		this.sid = sid;
	}

	private String name;
	private String passWord;
	private int role;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getPassWord() {
		return passWord;
	}
	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}
	public int getRole() {
		return role;
	}
	public void setRole(int role) {
		this.role = role;
	}

	/**
	 * 用户登陆
	 * @return
	 */
	public String index(){
		//判断当前登陆的人事学生还是管理员或者是教师
	/*	学生:<input type="radio" name="role" value="3">
			教师:<input type="radio" name="role" value="2">
			管理员:<input type="radio" name="role" value="1"> */
		String hql="from ClassRoom where isDelete = 2";
		List<ClassRoom> clas = classRoomService.getByHQL(hql, null);
		ActionContext.getContext().put("clas", clas);
		NoticeInfo notice = noticeInfoService.loadNew();
		ActionContext.getContext().put("notice", notice);
		HttpSession session =	ServletActionContext.getRequest().getSession();
		String s =TimeSetUtil.startTime;
		String e =	TimeSetUtil.endtTime;
		session.setAttribute("s", s);
		session.setAttribute("e", e);
		Map<String, Object> alias  = new HashMap<String, Object>();
		String hqls = "from Student where name = :name and passWord = :passWord";
		if(role == 3){
			alias.put("name", name);
			alias.put("passWord", passWord);
			Student stu =studentService.getOneByHql(hqls, alias);
			if(stu != null){
				session.setAttribute("userName", stu.getName());
				session.setAttribute("passWord", stu.getPassWord());
				session.setAttribute("userId", stu.getId());
				session.setAttribute("type", 3);
				session.setAttribute("roleType", 3);
				Student c = studentService.getById(stu.getId());
				ActionContext.getContext().put("c", c);

				return SUCCESS;
			}else{
				return "login";
			}
		}else{
			String hqlss = "from Manage where name = :name and passWord = :passWord and type = :type";
			alias.put("name", name);
			alias.put("passWord", passWord);
			alias.put("type", role);
			Manage ma =	manageService.getOneByHql(hqlss, alias);
			if(ma != null){
				session.setAttribute("userName", ma.getName());
				session.setAttribute("userId", ma.getId());
				session.setAttribute("type", role);
				session.setAttribute("roleType", role);
				Manage m= manageService.getById(ma.getId());
				ActionContext.getContext().put("m", m);
				return SUCCESS;
			}else{
				return "login";
			}
		}
	}

	//登陆页面
	public String login() {
		return "success";
	}

	//退出
	public String tuichu() {
		ActionContext ac = ActionContext.getContext();
		Map session = ac.getSession();
		session.remove("userName");
		session.remove("userId");
		return "login";
	}
}

ManageAction

package com.xznu.edu.leave.action;


import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.github.abel533.echarts.axis.CategoryAxis;
import com.github.abel533.echarts.axis.ValueAxis;
import com.github.abel533.echarts.code.Trigger;
import com.github.abel533.echarts.data.PieData;
import com.github.abel533.echarts.json.GsonOption;
import com.github.abel533.echarts.series.Bar;
import com.github.abel533.echarts.series.Pie;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.xznu.edu.leave.model.ClassRoom;
import com.xznu.edu.leave.model.Manage;
import com.xznu.edu.leave.service.ClassRoomService;
import com.xznu.edu.leave.service.ManageService;
import com.xznu.edu.leave.utils.Pager;
import com.xznu.edu.leave.utils.TimeSetUtil;

import net.sf.json.JSONArray;
@Controller("manageAction")
@Scope("prototype")
public class ManageAction extends ActionSupport implements ModelDriven<Manage>{

	@Autowired
	private ClassRoomService classRoomService;
	private Manage manage;
	@Autowired
	private ManageService manageService;
	//=============================================================================================================
	private String startTime;
	private String endTime;
	public String getStartTime() {
		return startTime;
	}
	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}
	public String getEndTime() {
		return endTime;
	}
	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	private File file;
	//提交过来的file的名字
	private String fileFileName;

	//提交过来的file的MIME类型
	private String fileContentType;
	public File getFile() {
		return file;
	}
	public void setFile(File file) {
		this.file = file;
	}
	public String getFileFileName() {
		return fileFileName;
	}
	public void setFileFileName(String fileFileName) {
		this.fileFileName = fileFileName;
	}
	public String getFileContentType() {
		return fileContentType;
	}
	public void setFileContentType(String fileContentType) {
		this.fileContentType = fileContentType;
	}
	//=====================================

	public String setTime(){

		return SUCCESS;
	}

	public String setTimes(){
		TimeSetUtil.endtTime = endTime;
		TimeSetUtil.startTime= 	startTime;
		HttpSession session =	ServletActionContext.getRequest().getSession();
		String s =TimeSetUtil.startTime;
		String e =	TimeSetUtil.endtTime;
		session.setAttribute("s", s);
		session.setAttribute("e", e);
		ActionContext.getContext().put("url", "/manage_setTime.do");
		return "redirect";
	}

	/**
	 * 列表
	 */
	public String manage(){
		Pager<Manage> pagers = manageService.findPager(manage);
		ActionContext.getContext().put("pagers", pagers);
		ActionContext.getContext().put("manage", manage);
		return SUCCESS;
	}

	/**
	 * 跳转到添加页面
	 * @return
	 */
	public String add(){
		//查询所有班级信息
		String hql="from ClassRoom where isDelete = 2";
		List<ClassRoom> clas = classRoomService.getByHQL(hql, null);
		ActionContext.getContext().put("clas", clas);
		return SUCCESS;
	}

	/**
	 * 添加
	 * @return
	 */
	public String exAdd(){
		manage.setIsDelete(2);
		manage.setType(2);
		manage.setPassWord("111111");
		manageService.save(manage);
		ActionContext.getContext().put("url", "/manage_manage.do");
		return "redirect";
	}
	/**
	 * 跳转修改页面
	 * @return
	 */
	public String update(){
		String hql="from ClassRoom where isDelete = 2";
		List<ClassRoom> clas = classRoomService.getByHQL(hql, null);
		ActionContext.getContext().put("clas", clas);
		Manage c = manageService.getById(manage.getId());
		ActionContext.getContext().put("c", c);
		return SUCCESS;
	}

	public String exUpdate(){
		manage.setIsDelete(2);
		manage.setType(2);
		manage.setPassWord("111111");
		manageService.update(manage);
		ActionContext.getContext().put("url", "/manage_manage.do");
		return "redirect";
	}

	public String exUpdate2(){
		manage.setIsDelete(2);
		manage.setType(2);

		manageService.update(manage);
		return "login";
	}
	public String exUpdate3(){
		Manage c = manageService.getById(manage.getId());
		c.setPassWord(manage.getPassWord());
		manageService.update(manage);
		return "login";
	}
	/**
	 * 删除
	 * @return
	 */
	public String delete(){
		Manage c = manageService.getById(manage.getId());
		c.setIsDelete(1);
		manageService.update(c);
		ActionContext.getContext().put("url", "/manage_manage.do");
		return "redirect";
	}

	/**
	 * 登陆以后进入首页
	 * @return
	 */
	public String index(){
		Manage ma =	manageService.login(manage);
		if(ma == null){
			return "login";
		}
		HttpSession session =	ServletActionContext.getRequest().getSession();
		session.setAttribute("userName", ma.getName());
		session.setAttribute("userIdLogo", ma.getId());
		session.setAttribute("userType", ma.getType());
		session.setAttribute("userId", ma.getType());
		return "index";
	}

	/**
	 * 跳到管理员页面,并且顺带查询管理员列表分页
	 * @return
	 */
//	public String manage(){
//		Pager<Manage> pagers = manageService.list(manage);
//		ActionContext.getContext().put("pagers", pagers);
//		return SUCCESS;
//		
//	}
	/**
	 * 跳转添加页面
	 * @return
	 */
	public String addManage(){
		return SUCCESS;
	}
	/**
	 * 添加
	 * @return
	 * @throws IOException
	 */
	public void manageAdd() throws IOException{
		HttpServletResponse resp = ServletActionContext.getResponse();
		resp.setContentType("application/json;charset=UTF-8");
		PrintWriter out = null;
		manage.setType(2);
		manageService.save(manage);
		out = resp.getWriter();
		out.write(JSONArray.fromObject(1).toString());
	}

	/**
	 *
	 * @return
	 */
	public String manageEdit(){
		Manage ma =	manageService.getById(manage.getId());
		ActionContext.getContext().put("ma", ma);
		return SUCCESS;

	}

	public String manageEdit2(){
		Manage ma =	manageService.getById(manage.getId());
		ActionContext.getContext().put("ma", ma);
		return SUCCESS;

	}

	public void  editmanage() throws IOException{
		HttpServletResponse resp = ServletActionContext.getResponse();
		resp.setContentType("application/json;charset=UTF-8");
		PrintWriter out = null;
		//Manage ma =	manageService.getById(manage.getId());
		/*ma.setPassWord(manage.getPassWord());
		ma.setRealName(manage.getRealName());
		ma.setName(manage.getName());
		ma.setId(manage.getId());*/
		manageService.updateInfo(manage);
		out = resp.getWriter();
		out.write(JSONArray.fromObject(1).toString());
	}

	public String delManage(){
		manageService.deleteInfo(manage.getId());
		ActionContext.getContext().put("url", "/manage_manage.do");
		return "redirect";
	}

	public Manage getModel() {
		if(manage==null) manage = new Manage();
		return manage;
	}

	/**
	 * 获取用户列表
	 * @return
	 *//*
	public String userList(){
	Pager<User>	pagers = userService.listAll(userName);
	//这里需要对等级进行遍历
	List<Grade> list = gradeService.list();
	if(pagers != null && pagers.getDatas() != null && pagers.getDatas().size()>0){
		for(User u : pagers.getDatas()){
			//对这里的人 进行遍历
			for(Grade g: list){
				if(u.getJifen()>=g.getStartMin() && u.getJifen() <=g.getEndMax()){
					u.setDengji(g.getName());
				}
			}
		}
	}
	ActionContext.getContext().put("pagers", pagers);
	ActionContext.getContext().put("userName1", userName);
	return SUCCESS;
	}*/

	/**
	 * 根据用户id查询所有图片
	 * @return
	 */
	/*public String userPhotos(){
		Pager<SayMood>	pagers = sayMoodService.findAllphotosById(userId);
		ActionContext.getContext().put("pagers", pagers);
		return SUCCESS;
	}
	*/
	/**
	 * 删除照片
	 * @return
	 */
	/*public String delsay(){
		 sayMoodService.del(sayId);
		ActionContext.getContext().put("url", "/manage_userPhotos.do");
		return "redirect";
	}*/
	/*//删除用户
	public String delUse(){
		userService.delUse(userId);
		ActionContext.getContext().put("url", "/manage_userList.do");
		return "redirect";
	}
	
	//经警告用户
	
	public String jinggao(){
		messageService.updatejinggao(userId);
		ActionContext.getContext().put("url", "/manage_userList.do");
		return "redirect";
	}*/
	/**
	 * 图片上传
	 * @return
	 * @throws Exception
	 */
	/*public String fileUpload() throws Exception{
		HttpSession session =	ServletActionContext.getRequest().getSession();
		if(session.getAttribute("userId") != null){
			int userId = Integer.parseInt( session.getAttribute("userId").toString());
			
			 String root = ServletActionContext.getServletContext().getRealPath("/")+"upload";
			//String root = ServletActionContext.getServletContext().getRealPath("upload"); 
			//String root = ServletActionContext.getRequest().getContextPath()+"/"+"upload";
		        InputStream is = new FileInputStream(file);
		        fileFileName = UUIDUtils.create()+fileFileName;
		        OutputStream os = new FileOutputStream(new File(root, fileFileName));
		        System.out.println("fileFileName: " + fileFileName);
		        System.out.println("file: " + file.getName());
		        System.out.println("file: " + file.getPath());
		        byte[] buffer = new byte[500];
		        int length = 0;
		        
		        while(-1 != (length = is.read(buffer, 0, buffer.length)))
		        {
		            os.write(buffer);
		        }
		        os.close();
		        is.close();
		        //接下来存到说说表中
		        SayMood sayMood = new SayMood();
		        sayMood.setContent("\\upload\\"+fileFileName);
		        sayMood.setCreateTime(new Date());
		        sayMood.setDzs(0);
		        sayMood.setIsDelete(2);
		        sayMood.setType(2);
		        User u = userService.getUser(userId);
		        sayMood.setSayUser(u);
		        sayMoodService.save(sayMood);
		        *//**
	 * 积分规则还没有做。上传图片需要加积分
	 *//*
		        //上传完毕,跳转列表action
		        ActionContext.getContext().put("url", "/user_homePage.do");
		        return "redirect";
		}else{
			return "login";
		}
	}*/

	public String report(){
		return SUCCESS;
	}
	//下面进行报表
	/**
	 * 查询上个月和这个月 账号注册
	 * @throws IOException
	 */
	/*public void reportUser() throws IOException{
		HttpServletResponse resp = ServletActionContext.getResponse();
		resp.setContentType("application/json;charset=UTF-8");
		PrintWriter out = null;
		//首先查询本月和上个月用户总人数
		List<User>	users = userService.findSYuser();
		List<User>	users2 = userService.findBYuser();
		List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
		Map<String, Object> map1 = new HashMap<String, Object>();
		map1.put("NAME", getsy());
		if(users != null && users.size()>0){
			map1.put("TOTAL", users.size());
		}else{
			map1.put("TOTAL", 0);
		}
		
		Map<String, Object> map2 = new HashMap<String, Object>();
		map2.put("NAME", getBy());
		if(users2 != null && users2.size()>0){
			map2.put("TOTAL", users2.size());
		}else{
			map2.put("TOTAL", 0);
		}
		list.add(map1);
		list.add(map2);
		
		 //创建Option
	    GsonOption option = new GsonOption();
	    option.title("注册人数").tooltip(Trigger.axis).legend("数量(人)");
	    //横轴为值轴
	    option.xAxis(new ValueAxis().boundaryGap(0d, 0.01));
	    //创建类目轴
	    CategoryAxis category = new CategoryAxis();
	    //柱状数据
	    Bar bar = new Bar("月份");
	    //饼图数据
	    Pie pie = new Pie("月份");
	    //循环数据
	    for (Map<String, Object> objectMap : list) {
	        //设置类目
	        category.data(objectMap.get("NAME"));
	        //类目对应的柱状图
	        bar.data(objectMap.get("TOTAL"));
	        //饼图数据
	        pie.data(new PieData(objectMap.get("NAME").toString(), objectMap.get("TOTAL")));
	    }
	    //设置类目轴
	    option.yAxis(category);
	    //饼图的圆心和半径
	    pie.center(900,380).radius(100);
	    //设置数据
	    option.series(bar, pie);
	    //由于药品名字过长,图表距离左侧距离设置180,关于grid可以看ECharts的官方文档
	    option.grid().x(180);
	    //返回Option
	    out = resp.getWriter();
		 out.write(option.toString());
	}
	*/

	public String getBy(){
		Calendar c = Calendar.getInstance();
		c.add(Calendar.MONTH, -0);
		SimpleDateFormat format =  new SimpleDateFormat("yyyy-MM");
		String time = format.format(c.getTime());
		System.out.println(time);
		return time;
	}

	public String getsy(){
		Calendar c = Calendar.getInstance();
		c.add(Calendar.MONTH, -1);
		SimpleDateFormat format =  new SimpleDateFormat("yyyy-MM");
		String time = format.format(c.getTime());
		System.out.println(time);
		return time;
	}

	public void reportSay() throws IOException{/*
		  HttpServletResponse resp = ServletActionContext.getResponse();
			resp.setContentType("application/json;charset=UTF-8");
			PrintWriter out = null;
			//首先查询本月和上个月用户总人数
			List<SayMood>	users = sayMoodService.findSYusay();
			List<SayMood>	users2 = sayMoodService.findBYsay();
			List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
			Map<String, Object> map1 = new HashMap<String, Object>();
			map1.put("NAME", getsy());
			if(users != null && users.size()>0){
				map1.put("TOTAL", users.size());
			}else{
				map1.put("TOTAL", 0);
			}
			
			Map<String, Object> map2 = new HashMap<String, Object>();
			map2.put("NAME", getBy());
			if(users2 != null && users2.size()>0){
				map2.put("TOTAL", users2.size());
			}else{
				map2.put("TOTAL", 0);
			}
			list.add(map1);
			list.add(map2);
			
			 //创建Option
		    GsonOption option = new GsonOption();
		    option.title("发表图片数").tooltip(Trigger.axis).legend("数量(人)");
		    //横轴为值轴
		    option.xAxis(new ValueAxis().boundaryGap(0d, 0.01));
		    //创建类目轴
		    CategoryAxis category = new CategoryAxis();
		    //柱状数据
		    Bar bar = new Bar("月份");
		    //饼图数据
		    Pie pie = new Pie("月份");
		    //循环数据
		    for (Map<String, Object> objectMap : list) {
		        //设置类目
		        category.data(objectMap.get("NAME"));
		        //类目对应的柱状图
		        bar.data(objectMap.get("TOTAL"));
		        //饼图数据
		        pie.data(new PieData(objectMap.get("NAME").toString(), objectMap.get("TOTAL")));
		    }
		    //设置类目轴
		    option.yAxis(category);
		    //饼图的圆心和半径
		    pie.center(900,380).radius(100);
		    //设置数据
		    option.series(bar, pie);
		    //由于药品名字过长,图表距离左侧距离设置180,关于grid可以看ECharts的官方文档
		    option.grid().x(180);
		    //返回Option
		    out = resp.getWriter();
			 out.write(option.toString());
	  */}

	public String welcome(){
		return SUCCESS;
	}
}

CommentAction

package com.xznu.edu.leave.action;



import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.xznu.edu.leave.model.ClassRoom;
import com.xznu.edu.leave.model.Comment;
import com.xznu.edu.leave.model.Manage;
import com.xznu.edu.leave.model.Student;
import com.xznu.edu.leave.service.CommentService;
import com.xznu.edu.leave.utils.Pager;

@Controller("commentAction")
@Scope("prototype")
public class CommentAction extends ActionSupport implements ModelDriven<Comment>{
private Comment comment;
@Autowired
private CommentService commentService;


	public Comment getModel() {
		if(comment==null) comment = new Comment();
		return comment;
	}
	/**
	 * 列表
	 */
	public String comment(){
	Pager<Comment> pagers = commentService.findPager();
	ActionContext.getContext().put("pagers", pagers);
	ActionContext.getContext().put("comment", comment);
	return SUCCESS;
	}
	
	/**
	 * 跳转到添加页面
	 * @return
	 */
	public String add(){
		return SUCCESS;
	}
	
	/**
	 * 添加
	 * @return
	 */
	public String exAdd(){
		//当前是否有人
		HttpSession session =	ServletActionContext.getRequest().getSession();
		if(session.getAttribute("userId") != null){
			int userId = Integer.parseInt( session.getAttribute("userId").toString());
			comment.setCreateTime(new Date());
			comment.setIsDelete(2);
			Student s = new  Student();
			s.setId(userId);
			comment.setStudent(s);
			commentService.save(comment);
			
			ActionContext.getContext().put("url", "/comment_comment.do");
			return "redirect";
		}else{
			return "login";
		}
		
	}
	/**
	 * 跳转修改页面
	 * @return
	 */
	public String update(){
		Comment c = commentService.getById(comment.getId());
		ActionContext.getContext().put("c", c);
		return SUCCESS;
	}
    
	public String exUpdate(){
		commentService.update(comment);
		ActionContext.getContext().put("url", "/manage_manage.do");
		return "redirect";
	}
	/**
	 * 删除
	 * @return
	 */
	public String delete(){
		Comment c = commentService.getById(comment.getId());
		c.setIsDelete(1);
		commentService.update(c);
		ActionContext.getContext().put("url", "/comment_comment.do");
		return "redirect";
	}

	/**
	 * 评论
	 * @return
	 */
	/*public String comment() {
		HttpSession session =	ServletActionContext.getRequest().getSession();
		if(session.getAttribute("userId") != null){
			int userId = Integer.parseInt( session.getAttribute("userId").toString());
			CommentService.save(comment,userId,sayMoodId);
		}else{
			return "login";
		}
		ActionContext.getContext().put("url", "/sayMood_photoDetail.do?id="+sayMoodId+"&otherId="+otherId);
		return "redirect";
	}*/
	
	//评论说说 文字
	public String huifutext() {
		HttpSession session =	ServletActionContext.getRequest().getSession();
		if(session.getAttribute("userId") != null){
			int userId = Integer.parseInt( session.getAttribute("userId").toString());
		//	commentService.save(comment,userId,sayMoodId);
		}else{
			return "login";
		}
		ActionContext.getContext().put("url", "/sayMood_shuoshuoList.do");
		return "redirect";
	}
	/**
	 * 回复
	 * @return
	 */
	public String huifu() {
		HttpSession session =	ServletActionContext.getRequest().getSession();
		if(session.getAttribute("userId") != null){
			int userId = Integer.parseInt( session.getAttribute("userId").toString());
			commentService.savehuifu(comment,userId);
		}else{
			return "login";
		}
	//	ActionContext.getContext().put("url", "/sayMood_photoDetail.do?id="+sayMoodId+"&otherId="+otherId);
		return "redirect";
	}

	//说说文字回复
	public String huifuhft() {
		HttpSession session =	ServletActionContext.getRequest().getSession();
		if(session.getAttribute("userId") != null){
			int userId = Integer.parseInt( session.getAttribute("userId").toString());
			commentService.savehuifu(comment,userId);
		}else{
			return "login";
		}
		ActionContext.getContext().put("url", "/sayMood_shuoshuoList.do");
		return "redirect";
	}
	
	public String delComment(){
		//Pager<Comment> pager = CommentService.findComment(otherId);
		Comment c =	commentService.getById(comment.getId());
		commentService.deleteInfo(comment.getId());
		//ActionContext.getContext().put("url", "/comment_comment.do?otherId="+otherId);
		return "redirect";
	}
}

如果也想学习本系统,下面领取。关注并回复:048ssh

  • 2
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
Java基于ssm+mysql的高校学生请假管理系统的实现.zipJava基于ssm+mysql的高校学生请假管理系统的实现.zip 学生请假管理系统,主要有用户登陆、学生端、教师端、管理员端等功能, 用户登陆 学生请假管理系统采用用户名及密码验证模式,进入学生请假管理系统前,用户必须在登陆页面输入用户名及密码,只有验证通过的用户方可进入学生请假管理系统操作主页面。 学生端 包括2个功能模块: 学生个人信息的添加、修改功能,密码修改。 假条信息的添加、查询、打印功能。 (姓名,性别,学号,院系,年级,班级,手机号,辅导员,邮箱...可补充) (学号,姓名,联系方式,请假原因,请假时间,返校时间,审核状态,查询) 教师端 包括3个功能模块: 教师个人信息的添加、修改功能,密码修改。 学生个人信息的添加、修改、删除、查询功能。 假条信息的修改、删除、审批、查询、打印,导出功能。也可选择待办任务(同意拒绝都可附评语),已办任务处理假条。 (姓名,性别,工号,手机号,邮箱...可补充) (可补充) 管理员端 包括4个功能模块: 管理员个人信息的添加、修改、删除、查询,修改密码,功能。 教师个人信息的添加、修改、删除、查询功能。 学生个人信息的添加、修改、删除、查询功能。假条信息的查询、删除、打印,导出等功能
基于SSH(Struts2+Spring+Hibernate)的学生管理系统源码是一种使用Java开发的学生管理系统,它使用了SSH这一流行的开发框架组合。 这个学生管理系统的源码提供了一个完整的解决方案,用于管理学生的基本信息、课程信息、成绩、考勤、班级信息等。系统主要包括用户管理学生管理、课程管理、成绩管理等功能模块,可以满足学校或教育机构对学生管理的需求。 源码中使用了Struts2作为MVC(Model-View-Controller)框架,Spring作为IoC(Inversion of Control)和AOP(Aspect-Oriented Programming)框架,Hibernate作为ORM(Object-Relational Mapping)框架。这三个框架的结合使得系统的开发更加简洁高效,并且具备良好的可扩展性和维护性。 通过这个源码,可以学习到如何使用SSH框架进行项目开发,包括如何设计数据库模型、编写Hibernate映射文件、编写Struts2的Action类以及使用Spring来管理Bean。同时,源码中还应用了一些常用的技术,如JSP(JavaServer Pages)、HTML、CSS、JavaScript等,使得前端页面更加美观和可交互。 这个系统的源码还提供了一些额外的功能,例如数据的导入和导出、查询条件的设置、权限控制等,以满足实际使用中的一些需求。 总之,基于SSH学生管理系统源码是一个完整的、可复用的项目,对想要学习SSH框架以及学生管理系统开发的开发者而言,是一个很好的学习资源。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜未央5788

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值