首页 前端知识 基于javaweb mysql的ssm美食论坛系统(java ssm jsp jquery layui mysql)

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

2024-05-12 00:05:25 前端知识 前端哥 197 4 我要收藏

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

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

基于javaweb的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 登录
        try {
            //首先要使用Workbook类的工厂方法创建一个可写入的工作薄(Workbook)对象
            wwb = Workbook.createWorkbook(new File(fileName));
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (wwb != null) {
            //创建一个可写入的工作表
            //Workbook的createSheet方法有两个参数,第一个是工作表的名称,第二个是工作表在工作薄中的位置
            WritableSheet ws = wwb.createSheet("sheet1", 0);
            ws.setColumnView(0, 20);
            ws.setColumnView(1, 20);
            ws.setColumnView(2, 20);
            ws.setColumnView(3, 20);
            ws.setColumnView(4, 20);
            ws.setColumnView(5, 20);

            try {

                for (int i = 0; i < pros.length; i++) {
                    Label label1 = new Label(i, 0, "");

                    label1.setString(pros[i]);
                    ws.addCell(label1);
                }

            } catch (RowsExceededException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            } catch (WriteException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
            //下面开始添加单元格
            int i = 1;
            for (List t : mlist) {

                try {

                    Iterator it = t.iterator();
                    int jj = 0;
                    while (it.hasNext()) {
                        Label label1 = new Label(jj, i, "");

                        String a = it.next().toString();
                        label1.setString(a);
                        ws.addCell(label1);
                        jj++;
                    }
            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();
                int i = rsmd.getColumnCount();
                System.out.println(i);
                for (int j = 1; j <= i; j++) {
                    if (rsmd.getColumnName(j).equals("id")) continue;
                    typemap.put(rsmd.getColumnName(j) + "---", rsmd.getColumnTypeName(j));
                    collist.add(rsmd.getColumnName(j));
                    if (names.indexOf("," + rsmd.getColumnName(j) + ",") > -1) {

                        String[] values = request.getParameterValues(rsmd.getColumnName(j));
                        String value = "";
                        for (String vstr : values) {
                            if (vstr == null) vstr = "";
                            if (vstr.equals("null")) vstr = "";
                            if (vstr.trim().equals("")) continue;

@Controller
public class MgwordController extends BaseController {
	@Resource
	MgwordDAO mgwordDAO;
	
	//后台敏感字符列表
	@RequestMapping("admin/mgwordList")
	public String newsList(HttpServletRequest request) {
		String index = request.getParameter("index");
	   	int pageindex = 1;
	   	if(index!=null){
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	
	//删除回贴
	@RequestMapping("delHt")
	public void delHt(int id, HttpServletRequest request,HttpServletResponse response) {
		
		try {
			tzhtinfoDAO.delHt(id);
			PrintWriter out = response.getWriter();
			out.print(id);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	
	//我回复的贴子
	@RequestMapping("myHf")
	public String myHf(HttpServletRequest request){
		Member m = (Member)request.getSession().getAttribute("member");
		if(m!=null){
		List<Tzinfo> publishlist = tzinfoDAO.myTzinfo(m.getId());
		String index = request.getParameter("index");
	   	int pageindex = 1;
	   	if(index!=null){
	   		 pageindex = Integer.parseInt(index);
	   	}
   	    Page<Object> page = PageHelper.startPage(pageindex,6);
		List<Tzhtinfo> list = tzhtinfoDAO.selectNorepetition(m.getId());
		for(Tzhtinfo tzhtinfo:list){
			Tzinfo tzinfo = tzinfoDAO.findById(tzhtinfo.getTzid());
			List<Tzhtinfo> htlist = tzhtinfoDAO.selectHtinfo(tzinfo.getId());
			tzinfo.setAllhtlist(htlist);
			Bbstype ftype = bbstypeDAO.findById(tzinfo.getFid());
			tzhtinfo.setFtype(ftype);
			tzhtinfo.setTzinfo(tzinfo);
		}
		request.setAttribute("list", list);
		request.setAttribute("publishlist", publishlist);
		request.setAttribute("index", page.getPageNum());
		request.setAttribute("pages", page.getPages());
		request.setAttribute("total", page.getTotal());
			return "myhf";
		}else{
			return "login";
		}
	}
	

@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){
				Member banzhu = memberDAO.findById(banzhulist.get(0).getMemberid());
				list.get(i).setBanzhu(banzhu);
			}
		}
		request.setAttribute("list", list);
		request.setAttribute("index", page.getPageNum());
		request.setAttribute("pages", page.getPages());
		request.setAttribute("total", page.getTotal());
        return value;
    }

    public HashMap getmap(String id, String table) {
        List<HashMap> list = new ArrayList();
        try {
            Statement st = conn.createStatement();
            System.out.println("select * from " + table + " where id=" + id);
            ResultSet rs = st.executeQuery("select * from " + table + " where id=" + id);
            ResultSetMetaData rsmd = rs.getMetaData();
            while (rs.next()) {
                HashMap map = new HashMap();
                int i = rsmd.getColumnCount();
                for (int j = 1; j <= i; j++) {
                    if (!rsmd.getColumnName(j).equals("ID")) {
                        String str = rs.getString(j) == null ? "" : rs.getString(j);
                        if (str.equals("null")) str = "";
                        map.put(rsmd.getColumnName(j), str);
                    } else
                        map.put("id", rs.getString(j));
                }
                list.add(map);
            }
            rs.close();
            st.close();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return list.get(0);
    }

    public String insert(HttpServletRequest request, HttpServletResponse response, String tablename, HashMap extmap, boolean alert, boolean reflush) {
        extmap.put("savetime", Info.getDateStr());
        if (request.getParameter("f") != null) {
            HashMap typemap = new HashMap();
            ArrayList<String> collist = new ArrayList();
            String sql = "insert into " + tablename + "(";

            Connection conn = this.getConn();
            try {
                Statement st = conn.createStatement();
                ResultSet rs = st.executeQuery("select * from " + tablename);
                ResultSetMetaData rsmd = rs.getMetaData();
            try {
                Statement st = conn.createStatement();
                for (String str : collist) {
                    if (names.indexOf("," + str + ",") > -1) {
                        String[] values = request.getParameterValues(str);
                        String value = "";
                        for (String vstr : values) {
                            if (vstr == null) vstr = "";
                            if (vstr.equals("null")) vstr = "";
                            if (vstr.trim().equals("")) continue;

                            if (request.getParameter(vstr) != null && !"".equals(request.getParameter(vstr)) && request.getParameter("dk-" + str + "-value") != null) {
                                String dkv = request.getParameter(vstr);
                                String dknamevalue = request.getParameter("dk-" + str + "-value");
                                vstr += " - " + dknamevalue + ":" + dkv;
                            }

                            value += vstr + " ~ ";

                        }
                        if (value == null) value = "";
                        if (value.equals("null")) value = "";
                        if (value.length() > 0) value = value.substring(0, value.length() - 3);

                        if (typemap.get(str + "---").equals("int")) {
                            sql += (value.equals("") ? -10 : value) + ",";
                        } else {
                            sql += "'" + (value.equals("null") ? "" : value) + "',";
                        }
                    } else {
                        if (typemap.get(str + "---").equals("int")) {
                            sql += (extmap.get(str) == null ? "" : extmap.get(str)) + ",";
                        } else {
                            sql += "'" + (extmap.get(str) == null ? "" : extmap.get(str)) + "',";
                        }
                    }
                }

                sql = sql.substring(0, sql.length() - 1) + ")";
                System.out.println(sql);
                this.commOper(sql);

                st.close();
    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>";
        jscode += "<script language=\"javascript\">";
        jscode += "function fckinit()";
        jscode += "{";
        jscode += " var of = new FCKeditor(\"content\");";
        jscode += "of.BasePath=\"/vehiclemanagementsys/fckeditor/\";";
        jscode += "of.Height = \"" + height + "\";";
        jscode += "of.ToolbarSet=\"Default\";";
        jscode += "of.ReplaceTextarea();";
        jscode += "}";
        jscode += "fckinit();";
        jscode += "</script>";

        return jscode;
    }

    public synchronized static String subStr(String source, int length) {
        if (source.length() > length) {
            source = source.substring(0, length) + "...";
        }

        return source;
    }

    public static String getDateStr() {
        String dateString = "";
        try {//yyyyMMddHHmmss
            java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            java.util.Date currentTime_1 = new java.util.Date();
            dateString = formatter.format(currentTime_1);
        } catch (Exception e) {
        }
        return dateString;
    }
	@Resource
	SxinfoDAO sxinfoDAO;
	@Resource
	MemberDAO memberDAO;
	
	
	//查找私信人到私信添加页面
	@RequestMapping("sxShow")
	public String sxShow(int memberid,int sxmemberid, HttpServletRequest request) {
		Member member = memberDAO.findById(sxmemberid);
		request.setAttribute("sxmember", member);
		request.setAttribute("memberid", memberid);
		return "sxadd";
	}
	
	//添加私信
	@RequestMapping("sxAdd")
	public void jinyanJc(Sxinfo sxinfo, HttpServletRequest request,HttpServletResponse response) {
		try {
			sxinfo.setHfnote("");
			sxinfo.setSavetime(Info.getDateStr());
			sxinfoDAO.add(sxinfo);
			PrintWriter out = response.getWriter();
			out.print(sxinfo.getSxmemberid());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	
	//前台页面查询私信
	@RequestMapping("mysendSx")
	public String newsList(HttpServletRequest request) {
		Member member = (Member)request.getSession().getAttribute("member");
		String index = request.getParameter("index");
	   	int pageindex = 1;
	   	if(index!=null){
	   		 pageindex = Integer.parseInt(index);
	   	}
   	    Page<Object> page = PageHelper.startPage(pageindex,6);
		List<Sxinfo> list = sxinfoDAO.selectMysendsx(member.getId());
		for(Sxinfo sxinfo:list){
			Member sxmember = memberDAO.findById(sxinfo.getSxmemberid());
			sxinfo.setSxmember(sxmember);
		}
		request.setAttribute("list", list);
            dayNumber = (d2.getTime() - d1.getTime()) / mins;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return (int) dayNumber;
    }

    public static void main(String[] g) {
    }

    public static String getselect(String name, String tablename, String zdname) {
        String select = "<select name=\"" + name + "\" id=\"" + name + "\" >";
        for (HashMap permap : new CommDAO().select("select * from " + tablename + " order by id desc")) {
            select += "<option value=\"" + permap.get(zdname) + "\">" + permap.get(zdname) + "</option>";
        }
        select += "</select>";
        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) + " - ";
                }
            }
	   	}
   	    Page<Object> page = PageHelper.startPage(pageindex,6);
		List<Chat> list = chatDAO.searchKey(key);
		for(Chat chat:list){
			Member member = memberDAO.findById(chat.getMemberid());
			chat.setMember(member);
		}
		request.setAttribute("list", list);
		request.setAttribute("key", key);
		request.setAttribute("index", page.getPageNum());
		request.setAttribute("pages", page.getPages());
		request.setAttribute("total", page.getTotal());
		return "admin/msgsearch";
	}
	
	//意见和建议添加
	@RequestMapping("chatAdd")
	public void chatAdd(Chat chat, HttpServletRequest request,HttpServletResponse response) {
		try {
			chat.setSavetime(Info.getDateStr());
			chat.setHfmsg("");
			chatDAO.add(chat);
			PrintWriter out = response.getWriter();
			out.print(0);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	
	//管理员回复意见和建议
	@RequestMapping("admin/chatEdit")
	public String chatAdd(Chat chat, HttpServletRequest request) {
			chatDAO.update(chat);
		return "redirect:msgList.do";
		
	}
	
	
	//删除 
	@RequestMapping("admin/chatDel")
	public String chatDel(int id, HttpServletRequest request) {
                    jscode += "{\n";
                    jscode += "document.getElementById(\"txt4\").src=\"/vehiclemanagementsys/upfile/" + map.get("filename4") + "\";\n";
                    jscode += "}\n";

                    jscode += "if(document.getElementById(\"txt5\"))\n";
                    jscode += "{\n";
                    jscode += "document.getElementById(\"txt5\").src=\"/vehiclemanagementsys/upfile/" + map.get("filename5") + "\";\n";
                    jscode += "}\n";

                }
            }

            jscode += "}\n";

            jscode += " getPvalue();\n";
            jscode += "</script>\n";
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jscode;
    }

    public static String generalFileName(String srcFileName) {
        try {
            int index = srcFileName.lastIndexOf(".");
            return StrUtil.generalSrid() + srcFileName.substring(index).toLowerCase();
        } catch (Exception e) {
            return StrUtil.generalSrid();
        }
    }

    public synchronized static String getID() {
        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;
    }
		try {
			tzinfoDAO.updateIsjh(id);
			PrintWriter out = response.getWriter();
			out.print(id);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	
	//查找帖子到编辑帖子页面
	@RequestMapping("tzinfoShow")
	public String tzinfoShow(int id,HttpServletRequest request) {
		Member m = (Member)request.getSession().getAttribute("member");
		Member member = memberDAO.findById(m.getId());
		Tzinfo tzinfo = tzinfoDAO.findById(id);
		
		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);
			
		}
		request.setAttribute("member", member);
		request.setAttribute("typelist", typelist);
		request.setAttribute("tzinfo", tzinfo);
		return "tzedit";
	}
	
	//编辑帖子
	@RequestMapping("tzinfoEdit")
	public String tzinfoEdit(Tzinfo tzinfo,HttpServletRequest request) {
		tzinfoDAO.updata(tzinfo);
		return "redirect:memberCenter.do";
	}
	
	
	//删除贴子和回贴
	@RequestMapping("admin/tzinfoDel")
	public void tzinfoDel(int id,HttpServletRequest request,HttpServletResponse response) {
		try {
			PrintWriter out = response.getWriter();
			List<Tzhtinfo> htlist = tzhtinfoDAO.selectHtinfo(id);
			for(Tzhtinfo tzhtinfo:htlist){
				tzhtinfoDAO.delHt(tzhtinfo.getId());
			}
			tzinfoDAO.delete(id);

@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);
	   	}
   	    Page<Object> page = PageHelper.startPage(pageindex,6);
		List<Chat> list = chatDAO.selectAll();
		for(Chat chat:list){
			Member member = memberDAO.findById(chat.getMemberid());
			chat.setMember(member);
		}
		request.setAttribute("yqlinklist", yqlinklist);
		request.setAttribute("nowtzinfolist", nowtzinfolist);
		request.setAttribute("newslist", newslist);
		request.setAttribute("list", list);
	public String searchMsg(HttpServletRequest request){
		String index = request.getParameter("index");
		String key = request.getParameter("key");
	   	int pageindex = 1;
	   	if(index!=null){
	   		 pageindex = Integer.parseInt(index);
	   	}
   	    Page<Object> page = PageHelper.startPage(pageindex,6);
		List<Chat> list = chatDAO.searchKey(key);
		for(Chat chat:list){
			Member member = memberDAO.findById(chat.getMemberid());
			chat.setMember(member);
		}
		request.setAttribute("list", list);
		request.setAttribute("key", key);
		request.setAttribute("index", page.getPageNum());
		request.setAttribute("pages", page.getPages());
		request.setAttribute("total", page.getTotal());
		return "admin/msgsearch";
	}
	
	//意见和建议添加
	@RequestMapping("chatAdd")
	public void chatAdd(Chat chat, HttpServletRequest request,HttpServletResponse response) {
		try {
			chat.setSavetime(Info.getDateStr());
			chat.setHfmsg("");
			chatDAO.add(chat);
			PrintWriter out = response.getWriter();
			out.print(0);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	
	//管理员回复意见和建议
	@RequestMapping("admin/chatEdit")
	public String chatAdd(Chat chat, HttpServletRequest request) {
			chatDAO.update(chat);
		return "redirect:msgList.do";
		
	}
	
	
	//删除 
	@RequestMapping("admin/chatDel")
	public String chatDel(int id, HttpServletRequest request) {
			chatDAO.delete(id);
		return "redirect:msgList.do";
		
	}

@Controller
public class PbinfoController extends BaseController {
	@Resource
	PbinfoDAO pbinfoDAO;
	@Resource
	MemberDAO memberDAO;
	
	
	//屏蔽
	@RequestMapping("pbinfoAdd")
	public void pbinfoAdd(HttpServletRequest request,HttpServletResponse response){
		try {
			String memberid = request.getParameter("memberid");
			String pbmemberid = request.getParameter("pbmemberid");
			Pbinfo pbinfo = new Pbinfo();
			pbinfo.setMemberid(Integer.parseInt(memberid));
			pbinfo.setPbmemberid(Integer.parseInt(pbmemberid));
			pbinfoDAO.add(pbinfo);
			PrintWriter out = response.getWriter();
    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;
    }

    public String getCheckBoxValues(HttpServletRequest request, String name) {
        String value = "";
        if (request.getParameterValues(name) != null) {
            String[] values = request.getParameterValues(name);
            for (String str : values) {
                value += str + " ~ ";
            }
        }
        if (value.length() > 0) value = value.substring(0, value.length() - 6);
        return value;
    }

    public String getCheckBoxDkValues(HttpServletRequest request, String name) {
        String value = "";
        String[] values = request.getParameterValues(name);
        if (values != null) {
            for (String vstr : values) {
                if (vstr == null) vstr = "";
                if (vstr.equals("null")) vstr = "";
                if (vstr.trim().equals("")) continue;
                if (request.getParameter(vstr) != null && !"".equals(request.getParameter(vstr)) && request.getParameter("dk-" + name + "-value") != null) {
                    String dkv = request.getParameter(vstr);
                    String dknamevalue = request.getParameter("dk-" + name + "-value");
                    vstr += " - " + dknamevalue + ":" + dkv;
                }
                value += vstr + " ~ ";
            }

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

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

HTML5 基本框架

2024-09-01 23:09:50

HTML5取消边框的方法

2024-09-01 23:09:50

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