首页 前端知识 基于javaweb mysql的ssm校园心理咨询服务系统(java ssm jsp bootstrap jquery mysql)

基于javaweb mysql的ssm校园心理咨询服务系统(java ssm jsp bootstrap jquery mysql)

2024-06-20 09:06:28 前端知识 前端哥 188 799 我要收藏

基于javaweb+mysql的ssm校园心理咨询服务系统(java+ssm+jsp+bootstrap+jquery+mysql)

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb的SSM校园心理咨询服务系统(java+ssm+jsp+bootstrap+jquery+mysql)

功能介绍

基于SSM校园心理咨询服务平台系统分为学生、教师、管理员三种角色。

用户角色主要包括用户注册、用户登录、在线咨询、心理测试、论坛交流、账户维护等功能;

教师角色主要包括教师登录、文章管理、在线回复等功能;

管理员角色主要包括学生管理、教师管理、试题库管理、测试分类管理、试卷管理、新闻管理、系统介绍管理、会员评论管理、轮播图管理、友情链接管理、后台用户管理等功能;

最后根据详细设计的结果,运用JavaEE技术平台,使用更灵活的B/S开发模式和经典的SSM组合框架实现系统的MVC分层架构,并结合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版本;

技术栈

  1. 后端:Spring SpringMVC MyBatis 2. 前端:JSP+bootstrap+jQuery

使用说明

  1. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,下载所需jar包; 2. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 3. 将项目中db.properties配置文件中的数据库配置改为自己的配置 4. 配置tomcat,然后运行项目,输入localhost:8080/xxx 登录
		String  sex=request.getParameter("sex");
        String  des=request.getParameter("des");
		if (huiyuanSrv.isExist("where accountname='" + accountname
				+ "'")) {
				request.setAttribute("errormsg",
						"<label class='error'>用户名已经存在</label>");
				dispatchParams(request, response);
				forward("/e/register.jsp");
		}

		Huiyuan huiyuan = new Huiyuan();
		huiyuan.setAccountname(accountname == null ? "" : accountname);
		huiyuan.setPassword(password == null ? "" : password);
		//初始支付密码为登录密码
		huiyuan.setPaypwd(huiyuan.getPassword());
		if(mobile!=null)
		   huiyuan.setMobile(mobile); 
		if(address!=null)
		   huiyuan.setAddress(address);
		if(sex!=null)
			huiyuan.setSex(sex);
		else
			huiyuan.setSex("男");
		huiyuan.setNickname(accountname);
        huiyuan.setName(name);
		huiyuan.setRegdate(new Date());
        huiyuan.setIdcardno(idcardno==null?"":idcardno);
		huiyuan.setLogtimes(0);
		if(touxiang!=null)
			huiyuan.setTouxiang(touxiang);
		else
		    huiyuan.setTouxiang(request.getContextPath()
				+ "/upload/nopic.jpg");
		huiyuan.setEmail(email == null ? "" : email);
		huiyuan.setStatus(1);
		huiyuan.setYue(0);
		huiyuan.setDes(des==null?"":des);
		huiyuanSrv.save(huiyuan);
		String forwardurl=request.getParameter("forwardurl");
		if (forwardurl == null) {
			forwardurl = "/admin/huiyuanmanager.do?actiontype=get";
		}
		redirect(forwardurl);
	}

	public void delete() {
		String[] ids = request.getParameterValues("ids");
		if (ids == null)
			request.getSession().setAttribute("huiyuan", huiyuan);
			redirect(forwardurl);
		}

	}
	public void modifyPaypw() {

		String paypwd=request.getParameter("paypwd");
		String errorurl=request.getParameter("errorurl");
		String  forwardurl=request.getParameter("forwardurl");
		String repassword1=request.getParameter("repassword1");
		String id = request.getParameter("id");
		if (id == null||id=="")
			return;
		Huiyuan huiyuan =huiyuanSrv.load(new Integer(id));
		if(huiyuan!=null)
		{
			if(!huiyuan.getPaypwd().equals(paypwd)){
				request.setAttribute("errormsg",
						"<label class='error'>原始支付密码不正确</label>");
				forward(errorurl);
				return ;
			}
			huiyuan.setPaypwd(repassword1);
			huiyuanSrv.update(huiyuan);
			request.getSession().setAttribute("huiyuan", huiyuan);
			redirect(forwardurl);
		}
	}

	public void save() {
		String accountname = request.getParameter("accountname");
		String password = request.getParameter("password");
		String name = request.getParameter("name");
        String idcardno=request.getParameter("idcardno");
		String email = request.getParameter("email");
		String  mobile=request.getParameter("mobile");
		String  address=request.getParameter("address");
		String  touxiang=request.getParameter("touxiang");
		String  sex=request.getParameter("sex");
        String  des=request.getParameter("des");
		if (huiyuanSrv.isExist("where accountname='" + accountname
				+ "'")) {
				request.setAttribute("errormsg",
		String replytime = request.getParameter("replytime");
		String replycontent = request.getParameter("replycontent");
		String status = request.getParameter("status");
		String lyren = request.getParameter("lyren");
		String stname = request.getParameter("stname");
		SimpleDateFormat sdfleaveword = new SimpleDateFormat("yyyy-MM-dd");
		leaveword.setTitle(title);
		leaveword.setDcontent(dcontent);
		if (createtime != null) {
			try {
				leaveword.setCreatetime(sdfleaveword.parse(createtime));
			} catch (ParseException e) {
				e.printStackTrace();
			}
		}
		leaveword.setReplyren(replyren);
		if (replytime != null) {
			try {
				leaveword.setReplytime(sdfleaveword.parse(replytime));
			} catch (ParseException e) {
				e.printStackTrace();
			}
		}
		leaveword.setReplycontent(replycontent);
		
		leaveword.setLyren(lyren);
		leaveword.setStname(stname);
		lwSrv.update(leaveword);
		if (forwardurl == null) {
			forwardurl = "/admin/leavewordmanager.do?actiontype=get";
		}
		redirect(forwardurl);
	}

	/******************************************************
	 *********************** 加载内部支持*********************
	 *******************************************************/
	public void load() {
		//
		String id = request.getParameter("id");
		String actiontype = "save";
		dispatchParams(request, response);
		if (id != null) {
			Leaveword leaveword =lwSrv.load("where id=" + id);
			if (leaveword != null) {
				request.setAttribute("leaveword", leaveword);
			}
			actiontype = "update";
				}
			}
			shijuan.setStatus("组卷完成");
			shijuanSrv.update(shijuan);
			
			
		}
		
		redirect(forwardurl);
			
	}
	
	
  public void zujuanAuto() {
		
		String sjid=request.getParameter("sjid");
		String forwardurl=request.getParameter("forwardurl");
		String errorurl=request.getParameter("errorurl");
		Shijuan  shijuan=shijuanSrv.load("where id="+sjid);
		String  danxuancount=request.getParameter("danxuancount");
		
		String  danxuanfen=request.getParameter("danxuanfen");
	
		String  kemu=request.getParameter("kemu");
		
		int totaldanxuancount=ceshitiSrv.getRecordCount("where kemu='"+kemu+"'");
		if(totaldanxuancount<Integer.parseInt(danxuancount)){
			request.setAttribute("errormsg", MessageFormat.format("<label class='error'>题库单选题只有{0}道,请加入试题</label>",totaldanxuancount));
			forward(errorurl);
			return;
		}
		
		
		//加入测试题
	    randomCeshitiToPaper(danxuancount, danxuanfen, sjid);
	
		shijuan.setStatus("组卷完成");
		shijuanSrv.update(shijuan);
		
		redirect(forwardurl);
		
	}
  
  /**
   * 把单选题加入试卷
   * @param danxuancount  单选题数目
		System.out.println("forwardurl=" + forwardurl);
		if (forwardurl == null) {
			forwardurl = "/admin/shoucangmanager.jsp";
		}
		forward(forwardurl);
	}

}

@Controller
public class TeacherController extends SimpleController {

	@Override
	@RequestMapping("/admin/teachermanager.do")
	public void mapping(HttpServletRequest request, HttpServletResponse response) {
		
		mappingMethod(request,response);

	}
	public void modifyPw() {
		String password1 = request.getParameter("password1");
		String repassword1 = request.getParameter("repassword1");

		String forwardurl = request.getParameter("forwardurl");
		String errorpageurl = request.getParameter("errorpageurl");
		String id = request.getParameter("id");
		}
	}

}

@Controller
public class NoticeController extends SimpleController {

	@Autowired
	private NoticeMapper mapper;
	@Override
	@RequestMapping("/admin/noticemanager.do")
	public void mapping(HttpServletRequest request, HttpServletResponse response) {
		mappingMethod(request,response);

	}
	
	/********************************************************
	 ****************** 信息注销监听支持*****************************
	 *********************************************************/
	public void delete() {
		String id = request.getParameter("id");
		mapper.delete(" where id=" + id);
		get();
	}
		if (forwardurl == null) {
			forwardurl = "/admin/indexcolumnsmanager.do?actiontype=get";
		}
		redirect(forwardurl);
	}

	/******************************************************
	 *********************** 更新内部支持*********************
	 *******************************************************/
	public void update() {
		String forwardurl = request.getParameter("forwardurl");
		String id = request.getParameter("id");
		if (id == null)
			return;
		Indexcolumns indexcolumns = icSrv.load(new Integer(id));
		if (indexcolumns == null)
			return;
		String coldes = request.getParameter("coldes");
		String colid = request.getParameter("colid");
		String xtype = request.getParameter("xtype");
		String showstyle = request.getParameter("showstyle");
		String layout=request.getParameter("layout");
		String width=request.getParameter("width");
		
		indexcolumns.setColdes(coldes);
		indexcolumns.setColid(colid == null ? 0 : new Integer(colid));
		indexcolumns.setXtype(xtype);
		indexcolumns.setShowstyle(showstyle);
		indexcolumns.setLayout(layout);
		indexcolumns.setWidth(width);
		icSrv.update(indexcolumns);
		
		if (forwardurl == null) {
			forwardurl = "/admin/indexcolumnsmanager.do?actiontype=get";
		}
		redirect(forwardurl);
	}

	/******************************************************
	 *********************** 加载内部支持*********************
	 *******************************************************/
	public void load() {
		//
		String id = request.getParameter("id");
		String actiontype = "save";
		dispatchParams(request, response);
		if (id != null) {
		List<Topic> listtopic = topicSrv.getPageEntitys(filter,
				pageindex, pagesize);
		int recordscount = topicSrv.getRecordCount(filter == null ? ""
				: filter);
		request.setAttribute("listtopic", listtopic);
		PagerMetal pm = new PagerMetal(recordscount);
		// 设置尺寸
		pm.setPagesize(pagesize);
		// 设置当前显示页
		pm.setCurpageindex(pageindex);
		// 设置分页信息
		request.setAttribute("pagermetal", pm);
		// 分发请求参数
		dispatchParams(request, response);
		String forwardurl = request.getParameter("forwardurl");
		System.out.println("forwardurl=" + forwardurl);
		if (forwardurl == null) {
			forwardurl = "/admin/topicmanager.jsp";
		}
		try {
			request.getRequestDispatcher(forwardurl).forward(request, response);
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	
}

	/*************************************************************
	 **************** 保存动作监听支持******************************
	 **************************************************************/
	public void save() {

		String forwardurl = request.getParameter("forwardurl");
		// 验证错误url
		String suzuid=request.getParameter("suzuid");
		String errorurl = request.getParameter("errorurl");
		
		String xtype=request.getParameter("xtype");
		if(suzuid!=null)
		{
			Lanmu temspc=lanmuSrv.load("where id="+suzuid);
			if(temspc!=null&&xtype!=null&&xtype.equals("1"))
			{
				Indexcolumns indexcolumns = new Indexcolumns();
				indexcolumns.setColdes(temspc.getTitle());
				indexcolumns.setColid(temspc.getId());
				indexcolumns.setXtype("资讯");
				indexcolumns.setShowstyle("图片");
				indexcolumns.setLayout("1");
				indexcolumns.setWidth("100%");
				
				icSrv.save(indexcolumns);
			}
		}
		if (forwardurl == null) {
			forwardurl = "/admin/indexcolumnsmanager.do?actiontype=get";
		}
		redirect(forwardurl);
	}

	/******************************************************
	 *********************** 更新内部支持*********************
	 *******************************************************/
	public void update() {
		String forwardurl = request.getParameter("forwardurl");
		String id = request.getParameter("id");
		if (id == null)
			return;
		Indexcolumns indexcolumns = icSrv.load(new Integer(id));
		if (indexcolumns == null)
			return;
		String coldes = request.getParameter("coldes");
		request.setAttribute("pagermetal", pm);
		// 分发请求参数
		dispatchParams(request, response);
		String forwardurl = request.getParameter("forwardurl");
		System.out.println("forwardurl=" + forwardurl);
		if (forwardurl == null) {
			forwardurl = "/admin/shijuanmanager.jsp";
		}
		forward(forwardurl);
	}
	
	
	
	public void waitExampaper() {
		
		String filter="";
		
		String  stno=request.getParameter("stno");
		
		String  title=request.getParameter("title");
	   
		if(stno!=null)
			filter+=" and stno='"+stno+"'";
		if(title!=null)
			filter+=" and title='"+title+"'";
		
		String nativateSql=" select sj.* from shijuan sj  where  sj.status='组卷完成'  ";
		
		List<Shijuan> listshijuan = shijuanSrv.query(nativateSql);
		
		request.setAttribute("listshijuan", listshijuan);
		
		// 分发请求参数
		dispatchParams(request, response);
		String forwardurl = request.getParameter("forwardurl");
		System.out.println("forwardurl=" + forwardurl);
		if (forwardurl == null) {
			forwardurl = "/admin/shijuanmanager.jsp";
		}
		forward(forwardurl);
	}
	
	@Autowired
	private ShijuanService shijuanSrv=null;
	@Autowired
	private DajuanService dajuanSrv=null;
	@Autowired
    private DajuanitemService djiSrv=null;
	@Autowired
	private CeshitiService  ceshitiSrv=null;
			filter += "  and scren='" + scren + "'  ";
		int pageindex = 1;
		int pagesize = 10;
		// 获取当前分页
		String currentpageindex = request.getParameter("currentpageindex");
		// 当前页面尺寸
		String currentpagesize = request.getParameter("pagesize");
		// 设置当前页
		if (currentpageindex != null)
			pageindex = new Integer(currentpageindex);
		// 设置当前页尺寸
		if (currentpagesize != null)
			pagesize = new Integer(currentpagesize);
		List<Shoucang> listshoucang =scSrv.getPageEntitys(filter,pageindex, pagesize);
		int recordscount = scSrv.getRecordCount(filter == null ? "" : filter);
		request.setAttribute("listshoucang", listshoucang);
		PagerMetal pm = new PagerMetal(recordscount);
		// 设置尺寸
		pm.setPagesize(pagesize);
		// 设置当前显示页
		pm.setCurpageindex(pageindex);
		// 设置分页信息
		request.setAttribute("pagermetal", pm);
		// 分发请求参数
		dispatchParams(request, response);
		String forwardurl = request.getParameter("forwardurl");
		System.out.println("forwardurl=" + forwardurl);
		if (forwardurl == null) {
			forwardurl = "/admin/shoucangmanager.jsp";
		}
		forward(forwardurl);
	}

}

		String shijuanid=request.getParameter("sjid");
		String tihao=request.getParameter("tihao");
		String forwardurl=request.getParameter("forwardurl");
		Shijuanitem sji=new Shijuanitem();
		
		String  tixing=request.getParameter("tixing");
		
		if(tixing!=null&&tixing.equals("1")){
			
			tixing="单选题";
		}
      
		if(shijuanid!=null&&tihao!=null){
			
			sjiSrv.delete(MessageFormat.format("where tihao={0} and shijuanid={1} and tixing=''{2}'' ",tihao,shijuanid,tixing));
						
		}
		redirect(forwardurl);
		
	}
  /**
   * 组卷 完成
   * 
   */
	public void zujuanOver() {
		
		String sjid=request.getParameter("sjid");
		String forwardurl=request.getParameter("forwardurl");
		Shijuan  shijuan=shijuanSrv.load("where id="+sjid);
		String[] shitiids = request.getParameterValues("tihaolist");
		
		if(shijuan!=null){
			
			
			if (shitiids != null) {
				for (String shitiid : shitiids) {

				
					Shijuanitem shijuanitem =sjiSrv.load(MessageFormat.format("where id={0} ", shitiid));
					//获取试题分数
					String fenshu = request.getParameter(shitiid);
					if(shijuanitem!=null){
						shijuanitem.setFenshu(Integer.parseInt(fenshu));
						sjiSrv.update(shijuanitem);
		String zujuanren = request.getParameter("zujuanren");
		String kemu = request.getParameter("kemu");
		String dajuanren = request.getParameter("dajuanren");
		String shijuanid = request.getParameter("shijuanid");
		String defen = request.getParameter("defen");
		SimpleDateFormat sdfdajuan = new SimpleDateFormat("yyyy-MM-dd");
		Dajuan dajuan = new Dajuan();
		dajuan.setTitle(title == null ? "" : title);
		dajuan.setZujuanren(zujuanren == null ? "" : zujuanren);
		dajuan.setKemu(kemu == null ? "" : kemu);
		dajuan.setDajuanren(dajuanren == null ? "" : dajuanren);
		dajuan.setShijuanid(shijuanid == null ? "" : shijuanid);
		dajuan.setDefen(defen == null ? 0 : new Integer(defen));
		dajuanSrv.save(dajuan);
		
		if (forwardurl == null) {
			forwardurl = "/admin/dajuanmanager.do?actiontype=get";
		}
		redirect(forwardurl);
	}

	
	/******************************************************
	 *********************** 更新内部支持*********************
	 *******************************************************/
	public void update() {
		String forwardurl = request.getParameter("forwardurl");
		String id = request.getParameter("id");
		if (id == null)
			return;
		Dajuan dajuan = dajuanSrv.load(new Integer(id));
		if (dajuan == null)
			return;
		String title = request.getParameter("title");
		String zujuanren = request.getParameter("zujuanren");
		String kemu = request.getParameter("kemu");
		String dajuanren = request.getParameter("dajuanren");
		String shijuanid = request.getParameter("shijuanid");
		String defen = request.getParameter("defen");
		SimpleDateFormat sdfdajuan = new SimpleDateFormat("yyyy-MM-dd");
		dajuan.setTitle(title);
		dajuan.setZujuanren(zujuanren);
		dajuan.setKemu(kemu);
		dajuan.setDajuanren(dajuanren);
		dajuan.setShijuanid(shijuanid);
		dajuan.setDefen(defen == null ? 0 : new Integer(defen));
		dajuanSrv.update(dajuan);
	
		if (forwardurl == null) {
			forwardurl = "/admin/dajuanmanager.do?actiontype=get";
		}
			forwardurl = "/admin/shijuanmanager.do?actiontype=get";
		}
		redirect(forwardurl);
	}

	
	/******************************************************
	 *********************** 更新内部支持*********************
	 *******************************************************/
	public void update() {
		String forwardurl = request.getParameter("forwardurl");
		String id = request.getParameter("id");
		
		if (id == null)
			return;
		Shijuan shijuan =shijuanSrv.load(new Integer(id));
		if (shijuan == null)
			return;
		String title = request.getParameter("title");
		String zujuanren = request.getParameter("zujuanren");
		String zongfen = request.getParameter("zongfen");
		String kmid=request.getParameter("kmid");
		String kemu = request.getParameter("kemu");
		String des = request.getParameter("des");
		String tupian=request.getParameter("tupian");
		SimpleDateFormat sdfshijuan = new SimpleDateFormat("yyyy-MM-dd");
		shijuan.setTitle(title);
		shijuan.setZujuanren(zujuanren);
		shijuan.setKmid(kmid==null?0:Integer.parseInt(kmid));
		shijuan.setZongfen(zongfen == null ? 0 : new Integer(zongfen));
		shijuan.setKemu(kemu);
		shijuan.setTupian(tupian==null?"":tupian);
		shijuan.setDes(des);
		shijuanSrv.update(shijuan);
	
		if (forwardurl == null) {
			forwardurl = "/admin/shijuanmanager.do?actiontype=get";
		}
		redirect(forwardurl);
	}

	/******************************************************
	 *********************** 加载内部支持*********************
	 *******************************************************/
			return;
		String title = request.getParameter("title");
		String commenttime = request.getParameter("commenttime");
		String commentren = request.getParameter("commentren");
		String commentcontent = request.getParameter("commentcontent");
		String xtype = request.getParameter("xtype");
		String belongid = request.getParameter("belongid");
		SimpleDateFormat sdfcomment = new SimpleDateFormat("yyyy-MM-dd");
		comment.setCommentren(commentren);
		comment.setCommentcontent(commentcontent);
		comment.setXtype(xtype);
		comment.setBelongid(belongid);
		commentSrv.update(comment);

		String forwardurl = request.getParameter("forwardurl");
		redirect(forwardurl);

	}

	/******************************************************
	 *********************** 加载内部支持*********************
	 *******************************************************/
	public void load() {
		//
		String id = request.getParameter("id");
		String actiontype = "save";
		if (id != null) {
			Comment comment = commentSrv.load( "where id="+ id);
			if (comment != null) {
				request.setAttribute("comment", comment);
			}
			actiontype = "update";
		}
		request.setAttribute("id", id);
		request.setAttribute("actiontype", actiontype);
		try {
			request.getRequestDispatcher("commentadd.jsp").forward(request,
					response);
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	/******************************************************
	 *********************** 数据绑定内部支持*********************
		redirect(forwardurl);
		
		
	}
	
	public void load(){
		String id = request.getParameter("id");
		String actiontype = "save";
		if (id != null) {
			Users users = (Users) usersService.load(new Integer(id));
			if (users != null) {
				request.setAttribute("users", users);
			}
			actiontype = "update";
		}
		request.setAttribute("id", id);
		request.setAttribute("actiontype", actiontype);
		String forwardurl=request.getParameter("forwardurl");
		if (forwardurl == null) {
			forwardurl = "/admin/usersadd.jsp";
		}
		forward(forwardurl);
	}
	public void delete() {
		String id = request.getParameter("id");
		usersService.delete(" where id=" + id);
		get();
	}
	public void get(){
		int pageindex = 1;
		int pagesize = 10;
		String filter="";
		// 获取当前分页
		String currentpageindex = request.getParameter("currentpageindex");
		// 当前页面尺寸
		String currentpagesize = request.getParameter("pagesize");
		// 设置当前页
		if (currentpageindex != null)
			pageindex = new Integer(currentpageindex);
		// 设置当前页尺寸
		if (currentpagesize != null)
			pagesize = new Integer(currentpagesize);
		
		List<Users> usersList=usersService.getPageEntitys(filter,pageindex,pagesize);
		int recordscount = usersService.getRecordCount(filter);
		request.setAttribute("usersList", usersList);
		teacher.setMobile(mobile);
		teacher.setLvli(lvli);
		
		teacherSrv.update(teacher);

		if (forwardurl == null) {
			forwardurl = "/admin/teachermanager.do?actiontype=get";
		}

		 redirect(forwardurl);

	}

	/******************************************************
	 *********************** 加载内部支持*********************
	 *******************************************************/
	public void load() {
		//
		String id = request.getParameter("id");
		String actiontype = "save";
		String forwardurl = request.getParameter("forwardurl");
		dispatchParams(request, response);
		if (id != null) {
			Teacher teacher = teacherSrv.load("where id="
					+ id);
			if (teacher != null) {
				request.setAttribute("teacher", teacher);
			}
			actiontype = "update";
			request.setAttribute("id", id);
		}

		
		request.setAttribute("actiontype", actiontype);

		if (forwardurl == null) {
			forwardurl = "/admin/teacheradd.jsp";
		}
		forward(forwardurl);

	}

	/******************************************************
	 *********************** 数据绑定内部支持*********************
	 *******************************************************/
	public void get() {
		String filter = "where 1=1 ";
		//
	/******************************************************
	 *********************** 更新内部支持*********************
	 *******************************************************/
	public void update() {
		String id = request.getParameter("id");
		String  forwardurl=request.getParameter("forwardurl");
		if (id == null)
			return;
		Notice notice =mapper.selectOne(new Integer(id));
		if (notice == null)
			return;
		String title = request.getParameter("title");
		String pubren = request.getParameter("pubren");
		String pubtime = request.getParameter("pubtime");
		String dcontent = request.getParameter("dcontent");
		SimpleDateFormat sdfnotice = new SimpleDateFormat("yyyy-MM-dd");
		notice.setTitle(title);
		notice.setPubren(pubren);
		
	    notice.setPubtime(new Date());
		
		notice.setDcontent(dcontent);
		mapper.update(notice);
		if(forwardurl==null)
			forwardurl="/admin/noticemanager.do?actiontype=get";
		redirect(forwardurl);
	}

	/******************************************************
	 *********************** 加载内部支持*********************
	 *******************************************************/
	public void load() {
		//
		String id = request.getParameter("id");
		String actiontype = "save";
		if (id != null) {
			Notice notice = mapper.load("where id=" + id);
			if (notice != null) {
				request.setAttribute("notice", notice);
			}
			actiontype = "update";
		}
		request.setAttribute("id", id);
		request.setAttribute("actiontype", actiontype);

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

转载请注明出处或者链接地址:https://www.qianduange.cn//article/12977.html
标签
评论
发布的文章

爱心

2024-06-27 17:06:24

读魏书生的心得体会

2024-07-03 14:07:10

jQuery 选择器

2024-05-12 00:05:34

Vue中public/assets目录区别

2024-07-02 23:07:29

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!