基于javaweb的SSM同城维修平台(java+ssm+mysql+jsp+tomcat)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

421223512708

431223512708

441223512708

451223512708

461223512708

481223512708

基于javaweb的SSM同城维修平台(java+ssm+mysql+jsp+tomcat)

首页:http://localhost:8080/tongchengweixiu
登录用户:
admin 123456 管理员
user1 123456 用户
user2 123456 用户
emp1 123456 员工
emp2 123456 员工

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

public static String getImgUpInfo3(int height)
{
String jscode = "";
jscode+="<img style=\"cursor: hand\" onclick=\"uploadimg3()\" src=\"/pianotrainwebstie/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\" onclick=\"uploadimg4()\" src=\"/pianotrainwebstie/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\" onclick=\"uploadimg5()\" src=\"/pianotrainwebstie/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=\"/pianotrainwebstie/fckeditor/\";";
jscode+="of.Height = \""+height+"\";";
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
	System.out.println("code===" + code);
JSONObject obj = new JSONObject();
String imgcode = (String) session.getAttribute("autoCode");
System.out.println("imgcode===" + imgcode);
if (code.equalsIgnoreCase(imgcode)) {
obj.put("res", "ok");
} else {
obj.put("res", "ng");
}
response.setContentType("text/html;charset=utf-8");
PrintWriter out = null;
try {
out = response.getWriter();
out.print(obj);
out.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
out.close();
}
}

@RequestMapping("admin/showUserInfo.do")
public String showUserInfo(ModelMap map, HttpSession session) {
if (session.getAttribute("auser") == null) {
return "admin/login";
}
Sysuser u = (Sysuser) session.getAttribute("auser");
map.put("user", userService.getById(u.getId()));
return "admin/user_update_persion";
}

@RequestMapping("admin/updatePersionUser.do")
public String updateUserInfo(@RequestParam(value = "file", required = false) MultipartFile file,
HttpServletRequest request, Sysuser user, HttpSession session, String img,ModelMap map) {
img=fileUpload(file, request, img);
user.setImg(img);
userService.update(user);
map.put("user", userService.getById(user.getId()));
session.setAttribute("suc", "cc");
return "redirect:showUserInfo.do";
}

// 后台登录
@RequestMapping("admin/alogin.do")
public String checkLogin(Sysuser user, HttpSession session) {
Map<String, Object> u = new HashMap<String, Object>();
System.out.println("name===" + user.getUname());
System.out.println("pwd===" + user.getPwd());
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
	if (userService.checkUname(map) != null) {

obj.put("info", "ng");
} else {
obj.put("info", "用户名可以用!");

}
response.setContentType("text/html;charset=utf-8");
PrintWriter out = null;
try {
out = response.getWriter();
out.print(obj);
out.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
out.close();
}
}

// 添加用户
@RequestMapping("admin/addUser.do")
public String addUser(@RequestParam(value = "file", required = false) MultipartFile file,
HttpServletRequest request, Sysuser user, HttpSession session, String img) {
img = fileUpload(file, request, img);
user.setImg(img);
user.setIsdel("1");
Timestamp time = new Timestamp(System.currentTimeMillis());
user.setPubtime(time.toString().substring(0, 19));
user.setJf(0);
userService.add(user);
return "redirect:userList.do";
}

// 处理更新用户的信息
@RequestMapping("admin/doUpdateUser.do")
public String doUpdateUser(ModelMap map, int id) {
System.out.println("id==" + id);
map.put("user", userService.getById(id));
return "admin/user_update";
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



public class testFilter extends HttpServlet implements Filter {
private FilterConfig filterConfig;

// Handle the passed-in FilterConfig
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
}

// Process the request/response pair
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain filterChain) {
/*try {
((HttpServletResponse) response).setHeader("Pragma", "No-cache");
((HttpServletResponse) response).setHeader("Cache-Control", "no-cache");
((HttpServletResponse) response).setHeader("Expires", "0");
//request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
filterChain.doFilter(request, response);
} catch (ServletException sx) {
filterConfig.getServletContext().log(sx.getMessage());
} catch (IOException iox) {
filterConfig.getServletContext().log(iox.getMessage());
}*/
/*HttpServletRequest req = null;
HttpSession session = req.getSession();
HashMap user = (HashMap)session.getAttribute("admin");
System.out.println("bbbbbbbbbbbbbbbbbbb--==="+user.get("uname"));*/
try {
//request.getRequestDispatcher("http://localhost:8080/xsgl").forward(request, response);
((HttpServletResponse)response).sendRedirect("http://localhost:808/tbm/index.jsp");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
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
	map.put("nlist", list);
map.put("nlist2", nlist2);
map.put("glist", glist);
return "index2";
}



@RequestMapping("showNews.do")
public String showNews(ModelMap map, int id) {
map.put("news", newsService.getById(id));
return "newsx";
}

// 分页
@RequestMapping("searchNews.do")
public String searchNews(@RequestParam(value = "page", required = false) String page, ModelMap map,
HttpSession session, News news) {
if (page == null || page.equals("")) {
page = "1";
}
PageBean pageBean = new PageBean(Integer.parseInt(page), PageBean.PAGESIZE);
Map<String, Object> pmap = new HashMap<String, Object>();
Map<String, Object> nmap = new HashMap<String, Object>();
pmap.put("pageno", pageBean.getStart());
pmap.put("pageSize", pageBean.getPageSize());
if (news.getName() != null && !news.getName().equals("")) {
pmap.put("name", news.getName());
nmap.put("name", news.getName());
}
int total = newsService.getCount(nmap);
System.out.println("total===" + total);
pageBean.setTotal(total);
List<News> list = newsService.getAll(pmap);
map.put("page", pageBean);
map.put("list", list);
session.setAttribute("p", 2);
return "newsList";
}

@RequestMapping("newsListFore.do")
public String newsListFore(@RequestParam(value = "page", required = false) String page, ModelMap map,
HttpSession session) {
if (page == null || page.equals("")) {
page = "1";
}
PageBean pageBean = new PageBean(Integer.parseInt(page), PageBean.PAGESIZE);
Map<String, Object> pmap = new HashMap<String, Object>();
pmap.put("pageno", pageBean.getStart());
pmap.put("pageSize", pageBean.getPageSize());
int total = newsService.getCount(null);
System.out.println("total===" + total);
pageBean.setTotal(total);
List<News> list = newsService.getByPage(pmap);
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




@Controller
public class ImgCodeController {
@SuppressWarnings("unused")
private static final long serialVersionUID = 1L;
private ByteArrayInputStream inputStream;

@RequestMapping("admin/showCode.do")
public String showCode(HttpSession session) throws Exception {
ImgCodeUtil rdnu = ImgCodeUtil.Instance();
this.setInputStream(rdnu.getImage()); // 取得带有随机字符串的图片
/*
* ActionContext.getContext().getSession() .put("imgCode",
* rdnu.getString());
*/
// 取得随机字符串放入HttpSession
System.out.println("imgcode"+rdnu.getString());
session.setAttribute("imgCode", rdnu.getString());
//设置当前session的有效时间为10*60秒
session.setMaxInactiveInterval(600);
return "";
}

public void setInputStream(ByteArrayInputStream inputStream) {
this.inputStream = inputStream;
}

public ByteArrayInputStream getInputStream() {
return inputStream;
}

}






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