基于javaweb+mysql的ssm美食论坛系统(java+ssm+jsp+jquery+layui+mysql)

基于javaweb+mysql的ssm美食论坛系统(java+ssm+jsp+jquery+layui+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

基于javaweb+mysql的SSM美食论坛系统(java+ssm+jsp+jquery+layui+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+jQuery+LayUI

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行; 3. 将项目中db.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入http://localhost:8080/cateforumssm 登录
		mgwordDAO.update(mgword);
		request.setAttribute("mgword", mgword);
		return "redirect:mgwordList.do";
	}
	
	//删除敏感字符
	@RequestMapping("admin/mgwordDel")
	public String mgwordDel(int id, HttpServletRequest request) {
		mgwordDAO.delete(id);
		return "redirect:mgwordList.do";
	}
	
	

}

@Controller
public class YqlinkController extends BaseController {
	@Resource
	YqlinkDAO yqlinkDAO;
        return select;
    }

    public static String getselect(String name, String tablename, String zdname, String where) {

        String select = "<select name=\"" + name + "\" id=\"" + name + "\" >";
        select += "<option value=\"\">不限</option>";
        for (HashMap permap : new CommDAO().select("select * from " + tablename + " where " + where + " order by id desc")) {
            String optionstr = "";

            if (zdname.split(";").length == 1) {

                optionstr = permap.get(zdname.split("~")[0]).toString();

            } else {
                for (String str : zdname.split(";")) {
                    String zdstr = str.split("~")[0];
                    String zdnamestr = str.split("~")[1].equals("无名") ? "" : (str.split("~")[1] + ":");
                    optionstr += zdnamestr + permap.get(zdstr) + " - ";
                }
            }

            if (optionstr.indexOf(" - ") > -1) optionstr = optionstr.substring(0, optionstr.length() - 3);
            select += "<option value=\"" + optionstr + "\">" + optionstr + "</option>";
        }
        select += "</select>";
        return select;
    }

    public static String getradio(String name, String tablename, String zdname, String where) {
        String radio = "";
        int dxii = 0;
        for (HashMap permap : new CommDAO().select("select * from " + tablename + " where  " + where + " order by id desc")) {
            String check = "";
            if (dxii == 0) check = "checked=checked";

            String optionstr = "";
            for (String str : zdname.split(";")) {
                String zdstr = str.split("~")[0];
                String zdnamestr = str.split("~")[1].equals("无名") ? "" : (str.split("~")[1] + ":");
                optionstr += zdnamestr + permap.get(zdstr) + " - ";
            }
            if (optionstr.length() > 0) optionstr = optionstr.substring(0, optionstr.length() - 3);

            radio += "<label><input type='radio' name='" + name + "' " + check + " value=\"" + optionstr + "\">" + optionstr + "</label>\n";
            dxii++;
        }
        return radio;
    }

	@RequestMapping("admin/login")
	public String login(User user ,HttpServletRequest request, HttpServletResponse response) {
			user.setUserpassword(user.getUserpassword());
		    List<User> list = userDao.selectOne(user);
		    if(list.size()==0){
		    	request.setAttribute("error", "用户名或密码错误");
		    	return "admin/login";
		    }else{
		    	request.getSession().setAttribute("admin", list.get(0));
		    	return "admin/index";
		    }

	}
	
	//退出
	@RequestMapping("admin/adminExit")
	public String adminExit(HttpServletRequest request) {
		request.getSession().removeAttribute("admin");
		return "admin/login";
	}

	@RequestMapping("admin/update")
	public String update(User user, HttpServletRequest request) {
		userDao.update(user);
		return "redirect:show.do?msg=msg";
	}
	
	
	@RequestMapping("admin/adminPwdEdit")
	public String updatepwd(int id,String oldpwd, HttpServletRequest request) {
		String newpwd = request.getParameter("newpwd");
		User user = userDao.findById(id);
		if(oldpwd.equals(user.getUserpassword())){
			userDao.updatepwd(id,newpwd);
			request.setAttribute("suc", "操作成功");
		}else{
			request.setAttribute("suc", "原密码错误");
		}
		return "admin/myaccount";
	}

	
	@RequestMapping("admin/adminShow")
	public String showid(HttpServletRequest request) {
		User u = (User)request.getSession().getAttribute("admin");
		User user = userDao.findById(u.getId());
		request.setAttribute("user", user);
		return "admin/useredit";
	}
	
	@RequestMapping("admin/userEdit")
            dateString = formatter.format(currentTime_1);
        } catch (Exception e) {
        }
        return dateString;
    }

    public static String getUTFStr(String str) {
        if (str == null) {
            return "";
        }

        try {
            str = new String(str.getBytes("ISO-8859-1"), "utf-8");
        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return str;
    }

    public static String getGBKStr(String str) throws UnsupportedEncodingException {
        if (str == null) {
            return "";
        }
        return new String(str.getBytes("ISO-8859-1"), "GBK");
    }

    public static String getGB2312Str(String str) throws UnsupportedEncodingException {
        if (str == null) {
            return "";
        }
        return new String(str.getBytes("ISO-8859-1"), "gb2312");
    }

    /**
     *
     * @param String date
     * @param int    day
     * @return
     */
    public static String getDay(String date, int day) {
        String b = date.substring(0, 10);
        String c = b.substring(0, 4);
        String d = b.substring(5, 7);
        String f = b.substring(8, 10);
        String aa = c + "/" + d + "/" + f;
		}
		request.setAttribute("bbstypelist", bbstypelist);
		request.setAttribute("member", member);
		return "tzadd";
		}else{
		return "login";
		}
	}
	
	//发贴
	@RequestMapping("tzinfoAdd")
	public String tzinfoAdd(Tzinfo tzinfo,HttpServletRequest request) {
		Bbstype bbstype = bbstypeDAO.findById(tzinfo.getSid());
		tzinfo.setSavetime(Info.getDateStr());
		tzinfo.setLooknum(0);
		tzinfo.setDznum(0);
		tzinfo.setFid(Integer.parseInt(bbstype.getFatherid()));
		tzinfo.setUpdatetime("");
		tzinfo.setIstop("no");
		tzinfo.setIsjh("no");
		tzinfoDAO.add(tzinfo);
		return "redirect:memberCenter.do";
	}
	
	
	//贴子详情
	@RequestMapping("tzDetail")
	public String tzDetail(int id, HttpServletRequest request) {
		Member mmm = (Member)request.getSession().getAttribute("member");
		tzinfoDAO.updateLooknum(id);
		Tzinfo tzinfo = tzinfoDAO.findById(id);
		Member member = memberDAO.findById(tzinfo.getAuthor());
		tzinfo.setMember(member);
		request.setAttribute("tzinfo", tzinfo);
		
		List<Yqlink> yqlinklist = yqlinkDAO.selectAll();
		//今日话题
		List<Tzinfo> nowtzinfolist = tzinfoDAO.selectNowtzinfo(Info.getDateStr().substring(0,10));
		List<News> newslist = newsDAO.selectAll();
		
		List<Bbstype> typelist = bbstypeDAO.selectAll();
		for(Bbstype bbstype:typelist){
			//子类
			List<Bbstype> childlist = bbstypeDAO.selectChildtype(bbstype.getId());
			PrintWriter out = response.getWriter();
			out.print(0);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}


@Controller
public class IndexController extends BaseController {
	@Resource
	MemberDAO memberDAO;
	@Resource
	BbstypeDAO bbstypeDAO;
	@Resource
	NewsDAO newsDAO;
	@Resource
                    st.execute("delete from " + tablename + " where id=" + did);
                    st.close();
                }
            }

        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public String getCols(String table) {
        String str = "";
        Connection conn = this.getConn();
        try {
            Statement st = conn.createStatement();
            ResultSet rs = st.executeQuery("select * from " + table);
            ResultSetMetaData rsmd = rs.getMetaData();

            int i = rsmd.getColumnCount();
            for (int j = 2; j <= i; j++) {
                str += rsmd.getColumnName(j) + ",";
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
        str = str.substring(0, str.length() - 1);

        return str;
    }

    public String update(HttpServletRequest request, HttpServletResponse response, String tablename, HashMap extmap, boolean alert, boolean reflush) {
        if (request.getParameter("f") != null) {
            Enumeration enumeration = request.getParameterNames();
            String names = ",";
            while (enumeration.hasMoreElements()) {
                names += enumeration.nextElement().toString() + ",";
            }
            HashMap typemap = new HashMap();
            ArrayList<String> collist = new ArrayList();
            String sql = "update " + tablename + " set ";
            Connection conn = this.getConn();
            try {
                Statement st = conn.createStatement();
                ResultSet rs = st.executeQuery("select * from " + tablename);
                ResultSetMetaData rsmd = rs.getMetaData();
	
	
	//贴子详情
	@RequestMapping("tzDetail")
	public String tzDetail(int id, HttpServletRequest request) {
		Member mmm = (Member)request.getSession().getAttribute("member");
		tzinfoDAO.updateLooknum(id);
		Tzinfo tzinfo = tzinfoDAO.findById(id);
		Member member = memberDAO.findById(tzinfo.getAuthor());
		tzinfo.setMember(member);
		request.setAttribute("tzinfo", tzinfo);
		
		List<Yqlink> yqlinklist = yqlinkDAO.selectAll();
		//今日话题
		List<Tzinfo> nowtzinfolist = tzinfoDAO.selectNowtzinfo(Info.getDateStr().substring(0,10));
		List<News> newslist = newsDAO.selectAll();
		
		List<Bbstype> typelist = bbstypeDAO.selectAll();
		for(Bbstype bbstype:typelist){
			//子类
			List<Bbstype> childlist = bbstypeDAO.selectChildtype(bbstype.getId());
			bbstype.setChildlist(childlist);
			//分类贴子
			List<Tzinfo> ftypetzinfolist = tzinfoDAO.selectTypetzinfo(bbstype.getId());
			bbstype.setFtypetzinfolist(ftypetzinfolist);
			
		}
		//回贴信息
		int tzid = id;
		List<Tzhtinfo> tzhtlist = tzhtinfoDAO.selectHtinfo(tzid);
		for(Tzhtinfo tzhtinfo:tzhtlist){
			Member htmember = memberDAO.findById(tzhtinfo.getAuthor());
			tzhtinfo.setHtmember(htmember);
		}
		//查看是否是版主
		String isbz = "";
		if(mmm!=null){
		Banzhu banzhu = new Banzhu();
		banzhu.setMemberid(mmm.getId());
		banzhu.setFid(tzinfo.getFid());

            if (zdname.split(";").length == 1) {

                optionstr = permap.get(zdname.split("~")[0]).toString();

            } else {
                for (String str : zdname.split(";")) {
                    String zdstr = str.split("~")[0];
                    String zdnamestr = str.split("~")[1].equals("无名") ? "" : (str.split("~")[1] + ":");
                    optionstr += zdnamestr + permap.get(zdstr) + " - ";
                }
            }

            if (optionstr.indexOf(" - ") > -1) optionstr = optionstr.substring(0, optionstr.length() - 3);
            select += "<option value=\"" + optionstr + "\">" + optionstr + "</option>";
        }
        select += "</select>";
        return select;
    }

    public static String getradio(String name, String tablename, String zdname, String where) {
        String radio = "";
        int dxii = 0;
        for (HashMap permap : new CommDAO().select("select * from " + tablename + " where  " + where + " order by id desc")) {
            String check = "";
            if (dxii == 0) check = "checked=checked";

            String optionstr = "";
            for (String str : zdname.split(";")) {
                String zdstr = str.split("~")[0];
                String zdnamestr = str.split("~")[1].equals("无名") ? "" : (str.split("~")[1] + ":");
                optionstr += zdnamestr + permap.get(zdstr) + " - ";
            }
            if (optionstr.length() > 0) optionstr = optionstr.substring(0, optionstr.length() - 3);

            radio += "<label><input type='radio' name='" + name + "' " + check + " value=\"" + optionstr + "\">" + optionstr + "</label>\n";
            dxii++;
        }
        return radio;
    }

@Controller
public class BbstypeController extends BaseController {
	@Resource
	BbstypeDAO bbstypeDAO;
	@Resource
	BanzhuDAO banzhuDAO;
	@Resource
	MemberDAO memberDAO;
	
	
	
	//后台版块列表
	@RequestMapping("admin/bbstypeList")
	public String bbstypeList(HttpServletRequest request) {
		String index = request.getParameter("index");
	   	int pageindex = 1;
	   	if(index!=null){
	   		 pageindex = Integer.parseInt(index);
	   	}
   	    Page<Object> page = PageHelper.startPage(pageindex,6);
		List<Bbstype> list = bbstypeDAO.selectAll();
		for(int i=0;i<list.size();i++){
			List<Bbstype> childlist  = bbstypeDAO.selectChildtype(list.get(i).getId());
			list.get(i).setChildlist(childlist);
			List<Banzhu> banzhulist = banzhuDAO.selectOne(list.get(i).getId());
			if(banzhulist.size()!=0){
	public String tzinfoList(HttpServletRequest request) {
		//将要返回大类子类到后台搜索
		List<Bbstype> flist = bbstypeDAO.selectFathertype();
		for(Bbstype bbstype:flist){
			List<Bbstype> childlist = bbstypeDAO.selectChildtype(Integer.parseInt(bbstype.getFatherid()));
			bbstype.setChildlist(childlist);
		}
		String index = request.getParameter("index");
	   	int pageindex = 1;
	   	if(index!=null){
	   		 pageindex = Integer.parseInt(index);
	   	}
   	    Page<Object> page = PageHelper.startPage(pageindex,6);
		List<Tzinfo> list = tzinfoDAO.selectAll();
		for(int i=0;i<list.size();i++){
			Bbstype ftype = bbstypeDAO.findById(list.get(i).getFid());
			Bbstype stype = bbstypeDAO.findById(list.get(i).getSid());
			list.get(i).setStype(stype);
			list.get(i).setFtype(ftype);
			//查看回贴数
			List<Tzhtinfo> allhtlist = tzhtinfoDAO.selectHtinfo(list.get(i).getId());
			list.get(i).setAllhtlist(allhtlist);
		}
		
		request.setAttribute("list", list);
		request.setAttribute("flist", flist);
		request.setAttribute("index", page.getPageNum());
		request.setAttribute("pages", page.getPages());
		request.setAttribute("total", page.getTotal());
		return "admin/tzlist";
	}
	
	
	//后台搜索帖子
	@RequestMapping("admin/searchTzinfo")
	public String searchTzinfo(HttpServletRequest request) {
		String key = request.getParameter("key");
		String key1 = request.getParameter("key1");
		String key2 = request.getParameter("key2");
		//将要返回大类子类到后台搜索
		List<Bbstype> flist = bbstypeDAO.selectFathertype();
		for(Bbstype bbstype:flist){
			List<Bbstype> childlist = bbstypeDAO.selectChildtype(Integer.parseInt(bbstype.getFatherid()));
			bbstype.setChildlist(childlist);
		}

public class CommDAO {

    public static Connection conn = null;

    public CommDAO() {
        conn = this.getConn();
    }

    private static Properties config = null;

    static {
        try {

            config = new Properties();
            // InputStream in = config.getClass().getResourceAsStream("dbconnection.properties");

            InputStream in = CommDAO.class.getClassLoader().getResourceAsStream("dbconnection.properties");

            config.load(in);
            System.out.println(config.get("dburl"));
            in.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public Connection getConn() {
        try {
            if (conn == null || conn.isClosed()) {
	        	/* Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
	            String dburl = (String)config.get("dburl");
	            conn = DriverManager.getConnection(dburl);*/

                String d = new Date().toLocaleString().substring(0, 9);

                Class.forName("com.mysql.jdbc.Driver");
                String dburl = (String) config.get("dburl");
                conn = DriverManager.getConnection(dburl, (String) config.get("user_name"), (String) config.get("user_pwd"));
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
        return conn;
    }

        Random random = new Random();
        StringBuffer ret = new StringBuffer(20);
        String rand = String.valueOf(Math.abs(random.nextInt()));
        ret.append(getDateStr());
        ret.append(rand.substring(0, 6));

        return ret.toString();
    }

    public static String getImgUpInfo(int height) {
        String jscode = "";
        jscode += "<img style=\"cursor: hand\" οnclick=\"uploadimg()\" src=\"/vehiclemanagementsys/js/nopic.jpg\" id=txt height=\"" + height + "\"/>";
        jscode += "<input type=hidden name=\"filename\" id=\"filename\" value=\"\" />";
        return jscode;
    }

    public static String getImgUpInfo2(int height) {
        String jscode = "";
        jscode += "<img style=\"cursor: hand\" οnclick=\"uploadimg2()\" src=\"/vehiclemanagementsys/js/nopic.jpg\" id=txt2 height=\"" + height + "\"/>";
        jscode += "<input type=hidden name=\"filename2\" id=\"filename2\" value=\"\" />";
        return jscode;
    }

    public static String getImgUpInfo3(int height) {
        String jscode = "";
        jscode += "<img style=\"cursor: hand\" οnclick=\"uploadimg3()\" src=\"/vehiclemanagementsys/js/nopic.jpg\" id=txt3 height=\"" + height + "\"/>";
        jscode += "<input type=hidden name=\"filename3\" id=\"filename3\" value=\"\" />";
        return jscode;
    }

    public static String getImgUpInfo4(int height) {
        String jscode = "";
        jscode += "<img style=\"cursor: hand\" οnclick=\"uploadimg4()\" src=\"/vehiclemanagementsys/js/nopic.jpg\" id=txt4 height=\"" + height + "\"/>";
        jscode += "<input type=hidden name=\"filename4\" id=\"filename4\" value=\"\" />";
        return jscode;
    }

    public static String getImgUpInfo5(int height) {
        String jscode = "";
        jscode += "<img style=\"cursor: hand\" οnclick=\"uploadimg5()\" src=\"/vehiclemanagementsys/js/nopic.jpg\" id=txt5 height=\"" + height + "\"/>";
        jscode += "<input type=hidden name=\"filename5\" id=\"filename5\" value=\"\" />";
        return jscode;
    }

    public static String fck(int height, String content) {
        String jscode = "<TEXTAREA   name=\"content\" id=\"content\">" + content + "</TEXTAREA>";
	//发贴
	@RequestMapping("tzinfoAdd")
	public String tzinfoAdd(Tzinfo tzinfo,HttpServletRequest request) {
		Bbstype bbstype = bbstypeDAO.findById(tzinfo.getSid());
		tzinfo.setSavetime(Info.getDateStr());
		tzinfo.setLooknum(0);
		tzinfo.setDznum(0);
		tzinfo.setFid(Integer.parseInt(bbstype.getFatherid()));
		tzinfo.setUpdatetime("");
		tzinfo.setIstop("no");
		tzinfo.setIsjh("no");
		tzinfoDAO.add(tzinfo);
		return "redirect:memberCenter.do";
	}
	
	
	//贴子详情
	@RequestMapping("tzDetail")
	public String tzDetail(int id, HttpServletRequest request) {
		Member mmm = (Member)request.getSession().getAttribute("member");
		tzinfoDAO.updateLooknum(id);
		Tzinfo tzinfo = tzinfoDAO.findById(id);
		Member member = memberDAO.findById(tzinfo.getAuthor());
		tzinfo.setMember(member);
		request.setAttribute("tzinfo", tzinfo);
		
		List<Yqlink> yqlinklist = yqlinkDAO.selectAll();
		//今日话题
		List<Tzinfo> nowtzinfolist = tzinfoDAO.selectNowtzinfo(Info.getDateStr().substring(0,10));
		List<News> newslist = newsDAO.selectAll();
		
		List<Bbstype> typelist = bbstypeDAO.selectAll();
		for(Bbstype bbstype:typelist){
			//子类
			List<Bbstype> childlist = bbstypeDAO.selectChildtype(bbstype.getId());
			bbstype.setChildlist(childlist);
			//分类贴子
			List<Tzinfo> ftypetzinfolist = tzinfoDAO.selectTypetzinfo(bbstype.getId());
			bbstype.setFtypetzinfolist(ftypetzinfolist);
			
		}
		//回贴信息
		int tzid = id;
		List<Tzhtinfo> tzhtlist = tzhtinfoDAO.selectHtinfo(tzid);
		for(Tzhtinfo tzhtinfo:tzhtlist){
			Member htmember = memberDAO.findById(tzhtinfo.getAuthor());
			tzhtinfo.setHtmember(htmember);
		}
		//查看是否是版主
		String isbz = "";
		if(mmm!=null){
		Banzhu banzhu = new Banzhu();
		banzhu.setMemberid(mmm.getId());
		banzhu.setFid(tzinfo.getFid());

@Controller
public class ChatController extends BaseController {
	@Resource
	ChatDAO chatDAO;
	@Resource
	MemberDAO memberDAO;
	@Resource
	BbstypeDAO bbstypeDAO;
	@Resource
	NewsDAO newsDAO;
	@Resource
	YqlinkDAO yqlinkDAO;
	@Resource
	TzinfoDAO tzinfoDAO;
	@Resource
	BanzhuDAO banzhuDAO;
	
	//前台意见和建议
	@RequestMapping("chatList")
	public String chatList(HttpServletRequest request){
		List<Yqlink> yqlinklist = yqlinkDAO.selectAll();
		List<Tzinfo> nowtzinfolist = tzinfoDAO.selectNowtzinfo(Info.getDateStr().substring(0,10));
		List<News> newslist = newsDAO.selectAll();
		
		String index = request.getParameter("index");
	   	int pageindex = 1;
	   	if(index!=null){
	   		 pageindex = Integer.parseInt(index);
	   	}
		request.setAttribute("pages", page.getPages());
		request.setAttribute("total", page.getTotal());
		return "admin/newslist";
	}
	
	//后台搜索新闻列表
	@RequestMapping("admin/searchNews")
	public String searchNews(HttpServletRequest request) {
		String index = request.getParameter("index");
		String title = request.getParameter("title");
	   	int pageindex = 1;
	   	if(index!=null){
	   		 pageindex = Integer.parseInt(index);
	   	}
   	    Page<Object> page = PageHelper.startPage(pageindex,6);
		List<News> list = newsDAO.searchNews(title);
		request.setAttribute("list", list);
		request.setAttribute("title", title);
		request.setAttribute("index", page.getPageNum());
		request.setAttribute("pages", page.getPages());
		request.setAttribute("total", page.getTotal());
		return "admin/newssearch";
	}
	//新增新闻
	@RequestMapping("admin/newsAdd")
	public String newsAdd(News news, HttpServletRequest request) {
		news.setSavetime(Info.getDateStr());
		newsDAO.add(news);
		return "redirect:newsList.do";
	}
	
    //删除新闻
	@RequestMapping("admin/newsDel")
	public String newsDel(int id, HttpServletRequest request) {
		newsDAO.delete(id);
		return "redirect:newsList.do";
	}
	
	//ID查找新闻
	@RequestMapping("admin/newsShow")
	public String newsShow(int id, HttpServletRequest request) {
		News news = newsDAO.findById(id);
		request.setAttribute("news", news);
		return "admin/newsedit";
	}
	
	//更新新闻
	@RequestMapping("admin/newsEdit")
	public String newsDel(News news, HttpServletRequest request) {
		newsDAO.update(news);
		return "redirect:newsList.do";
	}
	
	//前台新闻详情

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值