基于javaweb的SSH农业信息新闻管理系统(java+ssh+jsp+css+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

180023152402

190023152402

200023152402

210023152402

220023152402

240023152402

基于javaweb的SSH农业信息新闻管理系统(java+ssh+jsp+css+mysql)

1
2
3
4
5
6
7
前台用户:
user 123456
http://localhost:8080/ssm_nywz_sys

后台管理:
admin 123456
http://localhost:8080/ssm_nywz_sys/login_toLogin.do

项目介绍

管理员角色包含以下功能: 管理员登陆,用户管理,新闻管理,留言列表查看等功能。 用户角色包含以下功能: 查看所有新闻,市场资讯查看,科技推广查看,致富经栏目查看,网站留言,用户注册登陆等功能。

环境需要

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版本;

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+jsp

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录

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
46
47
48
49
50
51
52
53
54
public void setKeyword2(Integer keyword2) {
this.keyword2 = keyword2;
}

public String getUserName() {
return userName;
}

public void setUserName(String userName) {
this.userName = userName;
}

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;
}
//============自定义参数end=============

//-------------------------华丽分割线---------------------------------------------

//============文件上传start=============
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;
}

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
46
47
48
    }

/**
* 跳转修改页面
*
* @return
*/
public String update() {
Message n = messageService.getById(message.getId());
ActionContext.getContext().put("Obj", n);
return SUCCESS;
}

/**
* 执行修改
*
* @return
*/
public String exUpdate() {
Message n = messageService.getById(message.getId());
messageService.update(n);
ActionContext.getContext().put("url", "/message_message.do");
return "redirect";
}


/**
* 删除
*
* @return
*/
public String delete() {
messageService.delete(message.getId());
ActionContext.getContext().put("url", "/message_message.do");
return "redirect";
}

//=============公=======共=======方=======法==========区=========end============//

//-------------------------华丽分割线---------------------------------------------//

//=============自=======定=======义=========方=======法==========区=========start============//


//=============自=======定=======义=========方=======法==========区=========end============//


}
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
46
47
48
49
50
/**
* @ClassName:
* @Description:
*/

@Controller("newsAction")
@Scope("prototype")
public class NewsAction extends ActionSupport implements ModelDriven<News> {

private static final long serialVersionUID = 1L;

//==========model==============
private News news;

@Override
public News getModel() {
if (news == null) news = new News();
return news;
}
//==========model==============
/**
* 依赖注入 start dao/service/===
*/
@Autowired
private NewsService newsService;

//依赖注入 end dao/service/===

//-------------------------华丽分割线---------------------------------------------

//============自定义参数start=============

//============自定义参数end=============

//-------------------------华丽分割线---------------------------------------------

//============文件上传start=======================================================
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;
}
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
46
47
48
49
50
51
//     8 技术下乡
// -- 致富经
// 9致富新闻 -->
<li><a href="${ctx}/message_add.do?type=1">新闻中心</a></li>
<li><a href="${ctx}/message_add.do?type=2">市场资讯</a></li>
<li><a href="${ctx}/message_add.do?type=3">科技推广</a></li>
<li><a href="${ctx}/message_add.do?type=4">致富经</a></li>*/

public String news3() {

if (news.getType() == 1) {
Map<String, List<News>> map1 = new HashMap<String, List<News>>();
List<News> list1 = newsService.select5ByType(4, null);
map1.put("list1", list1);
Map<String, List<News>> map2 = new HashMap<String, List<News>>();
List<News> list2 = newsService.select5ByType(5, null);
map2.put("list2", list2);
ActionContext.getContext().put("map1", map1);
ActionContext.getContext().put("map2", map2);
}
if (news.getType() == 2) {
Map<String, List<News>> map1 = new HashMap<String, List<News>>();
List<News> list1 = newsService.select5ByType(6, null);
map1.put("list1", list1);
Map<String, List<News>> map2 = new HashMap<String, List<News>>();
List<News> list2 = newsService.select5ByType(7, null);
map2.put("list2", list2);
ActionContext.getContext().put("map1", map1);
ActionContext.getContext().put("map2", map2);
}
if (news.getType() == 3) {
Map<String, List<News>> map1 = new HashMap<String, List<News>>();
List<News> list1 = newsService.select5ByType(8, null);
map1.put("list1", list1);
ActionContext.getContext().put("map1", map1);
}
if (news.getType() == 4) {
Map<String, List<News>> map1 = new HashMap<String, List<News>>();
List<News> list1 = newsService.select5ByType(9, null);
map1.put("list1", list1);
ActionContext.getContext().put("map1", map1);
}
ActionContext.getContext().put("mytype", news.getType());
ActionContext.getContext().put("Obj", news);
return "success";
}

/**
* 跳转到添加页面
*
* @return
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
46
}

/**
* 执行修改
*
* @return
*/
public String exUpdate() {
User n = userService.getById(user.getId());
n.setPassWord(user.getPassWord());
n.setPhone(user.getPhone());
n.setRealName(user.getRealName());
n.setUserName(user.getUserName());
n.setEmail(user.getEmail());
userService.update(n);
ActionContext.getContext().put("url", "/user_user.do");
return "redirect";
}

public String exUpdate2() {
User n = userService.getById(user.getId());
n.setPassWord(user.getPassWord());
n.setPhone(user.getPhone());
n.setRealName(user.getRealName());
n.setUserName(user.getUserName());
n.setEmail(user.getEmail());
userService.update(n);
ActionContext.getContext().put("url", "/user_update2.do");
return "redirect";
}

public String exUpdate3() {
User n = userService.getById(user.getId());
n.setPassWord(user.getPassWord());
n.setPhone(user.getPhone());
n.setRealName(user.getRealName());
n.setUserName(user.getUserName());
n.setEmail(user.getEmail());
userService.update(n);
return "uLogin";
}

/**
* 删除
*
* @return


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