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

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

310023322402

320023322402

330023322402

340023322402

350023322402

360023322402

380023322402

390023322402

基于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 登录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
		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);
}
String index = request.getParameter("index");
int pageindex = 1;
if(index!=null){
pageindex = Integer.parseInt(index);
}
Page<Object> page = PageHelper.startPage(pageindex,6);
HashMap map = new HashMap();
map.put("title", key);
map.put("fid", key1);
map.put("sid", key2);
List<Tzinfo> list = tzinfoDAO.searchTzinfo(map);
for(int i=0;i<list.size();i++){
Bbstype ftype = bbstypeDAO.findById(list.get(i).getFid());
Bbstype stype = bbstypeDAO.findById(list.get(i).getSid());
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
                } else
list2.add(rs.getString(j));
}
list.add(list2);
}
rs.close();
st.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}


public void close() {

}

/**
* 执行一条查询sql,以 List<hashmap> 的形式返回查询的记录,记录条数,和从第几条开始,由参数决定,主要用于翻页
* pageno 页码 rowsize 每页的条数
*/
public List<HashMap> select(String sql, int pageno, int rowsize) {
List<HashMap> list = new ArrayList<HashMap>();
List<HashMap> mlist = new ArrayList<HashMap>();
try {
list = this.select(sql);
int min = (pageno - 1) * rowsize;
int max = pageno * rowsize;

for (int i = 0; i < list.size(); i++) {

if (!(i < min || i > (max - 1))) {
mlist.add(list.get(i));
}
}
} catch (RuntimeException re) {
re.printStackTrace();
throw re;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    String t[] = resu.split("-");
String sesuu = "";
for (int i = 0; i < t.length; i++) {
if (t[i].length() == 1) {
t[i] = "0" + t[i];
}
sesuu += t[i] + "-";
}

return sesuu.substring(0, 10);
}


/**
* 计算两个时期之间的天数
*/
public static int dayToday(String DATE1, String DATE2) {
int i = 0;
if (DATE1.indexOf(" ") > -1)
DATE1 = DATE1.substring(0, DATE1.indexOf(" "));
if (DATE2.indexOf(" ") > -1)
DATE2 = DATE2.substring(0, DATE2.indexOf(" "));

String[] d1 = DATE1.split("-");
if (d1[1].length() == 1) {
DATE1 = d1[0] + "-0" + d1[1];
} else {
DATE1 = d1[0] + "-" + d1[1];
}

if (d1[2].length() == 1) {
DATE1 = DATE1 + "-0" + d1[2];
} else {
DATE1 = DATE1 + "-" + d1[2];
}

String[] d2 = DATE2.split("-");
if (d2[1].length() == 1) {
DATE2 = d2[0] + "-0" + d2[1];
} else {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
}


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;
}


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");
}


/**
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44


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 + " ~ ";
}
}
if (value == null) value = "";
if (value.equals("null")) value = "";
if (value.length() > 0) value = value.substring(0, value.length() - 3);
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();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22



@Controller
public class MemberController extends BaseController {
@Resource
MemberDAO memberDAO;
@Resource
TzinfoDAO tzinfoDAO;
@Resource
BbstypeDAO bbstypeDAO;
@Resource
FansDAO fansDAO;
@Resource
PbinfoDAO pbinfoDAO;
@Resource
TzhtinfoDAO tzhtinfoDAO;
@Resource
SigninDAO signinDAO;




项目链接:
https://javayms.github.io?id=321422322105200kl
https://javayms.pages.dev?id=321422322105200kl