资源简介
Spring+SpringMVC+Mybatis最简单的整合示例,希望对大家有所帮助。

代码片段和文件信息
package test.actions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import test.services.UserServices;
@Controller
public class WebAction {
@Autowired
private UserServices userServices;
@RequestMapping(value = “/index“)
public String index() {
return “index“;
}
@RequestMapping(value = “/login“ method = RequestMethod.POST)
public String login(@RequestParam(“username“) String username
@RequestParam(“password“) String password ModelMap model) {
if (!userServices.isUserExist(username)) {
model.addAttribute(“msg“ “用户名不存在!“);
} else {
if (password.equals(userServices.getPasswordByUsername(username))) {
model.addAttribute(“msg“ “登录成功!“);
} else {
model.addAttribute(“msg“ “密码错误!“);
}
}
return “index“;
}
@RequestMapping(value = “/register“ method = RequestMethod.POST)
public String register(@RequestParam(“username“) String username
@RequestParam(“password“) String password ModelMap model) {
if (userServices.isUserExist(username)) {
model.addAttribute(“msg“ “用户名已存在!“);
} else {
userServices.addUser(username password);
model.addAttribute(“msg“ “注册成功!“);
}
return “index“;
}
@RequestMapping(value = “/modifyPassword“ method = RequestMethod.POST)
public String modifyPassword(@RequestParam(“username“) String username
@RequestParam(“password“) String password
@RequestParam(“newpassword“) String newpassword ModelMap model) {
if (!userServices.isUserExist(username)) {
model.addAttribute(“msg“ “用户名不存在!“);
} else {
if (password.equals(userServices.getPasswordByUsername(username))) {
userServices.modifyPasswordByUsername(username newpassword);
model.addAttribute(“msg“ “修改密码成功!“);
} else {
model.addAttribute(“msg“ “密码错误!“);
}
}
return “index“;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 841 2017-11-17 22:11 SSM\.classpath
文件 1036 2017-11-17 22:11 SSM\.project
文件 503 2017-11-17 22:11 SSM\.settings\.jsdtscope
文件 364 2017-11-17 22:11 SSM\.settings\org.eclipse.jdt.core.prefs
文件 461 2017-11-17 22:11 SSM\.settings\org.eclipse.wst.common.component
文件 345 2017-11-17 22:11 SSM\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2017-11-17 22:11 SSM\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2017-11-17 22:11 SSM\.settings\org.eclipse.wst.jsdt.ui.superType.name
文件 2612 2017-11-18 12:29 SSM\build\classes\test\actions\WebAction.class
文件 338 2017-11-18 12:28 SSM\build\classes\test\dao\UserDao.class
文件 964 2017-11-18 11:58 SSM\build\classes\test\entity\User.class
文件 997 2017-11-18 12:24 SSM\build\classes\test\mapper\User.xm
文件 1507 2017-11-18 12:30 SSM\build\classes\test\services\UserServices.class
文件 2239 2017-11-18 12:29 SSM\src\test\actions\WebAction.java
文件 283 2017-11-18 12:28 SSM\src\test\dao\UserDao.java
文件 509 2017-11-18 11:58 SSM\src\test\entity\User.java
文件 997 2017-11-18 12:24 SSM\src\test\mapper\User.xm
文件 1009 2017-11-18 12:30 SSM\src\test\services\UserServices.java
文件 39 2017-11-17 22:11 SSM\WebContent\me
文件 1145 2017-11-18 11:55 SSM\WebContent\views\index.jsp
文件 1534 2017-11-18 23:14 SSM\WebContent\WEB-INF\applicationContext.xm
文件 428 2017-11-17 22:23 SSM\WebContent\WEB-INF\configuration.xm
文件 61829 2014-07-05 20:11 SSM\WebContent\WEB-INF\lib\commons-logging-1.2.jar
文件 712734 2014-04-06 21:54 SSM\WebContent\WEB-INF\lib\mybatis-3.2.7.jar
文件 53312 2017-11-16 16:14 SSM\WebContent\WEB-INF\lib\mybatis-spring-1.3.1.jar
文件 999635 2017-08-29 04:13 SSM\WebContent\WEB-INF\lib\mysql-connector-java-5.1.44-bin.jar
文件 339104 2016-12-21 17:44 SSM\WebContent\WEB-INF\lib\spring-aop-3.2.18.RELEASE.jar
文件 51441 2016-12-21 17:46 SSM\WebContent\WEB-INF\lib\spring-aspects-3.2.18.RELEASE.jar
文件 614434 2016-12-21 17:44 SSM\WebContent\WEB-INF\lib\spring-beans-3.2.18.RELEASE.jar
文件 868229 2016-12-21 17:44 SSM\WebContent\WEB-INF\lib\spring-context-3.2.18.RELEASE.jar
............此处省略42个文件信息
相关资源
- SpringBoot+H2+mybatis-plus59130
- mybatis连接oracle实例
- 基于J2EE物资出入库管理系统
- 基于SSM+CXF构建的RESTFul webservice
- 大数据中的云网络Cloud Networking for B
- Spring+MyBatis企业应用实战第一二版的源
- springboot+rabbitmq项目demo(亲测可正常运
- springboot整合RabbitMQ实现延时队列的两
- 关于Spring MVC项目maven中通过fileupload上
- Spring-Data-Redis2.0+Spring5
- 2017年-传智播客-张志君老师-SpringBoo
- springboot+mybatis整合实现注册登录
-
spring-fr
amework-5.0.2.RELEASE 源码包 - 基于web的图书馆运营系统
- springboot+webflux+mongodb+freemarker
- springboot整合activiti完整demo
- SpringBoot实战(第4版)清晰版.pdf.zip
- SpringBoot 中文文档
- springboot+jpa+thymeleaf实现增删改查分页
- es(elasticsearch)整合SpringCloudSpringBo
- Springboot日志开启SLF4J过程解析
- 原银在线信贷平台概要设计说明书v
- springcloud 微服务(全套视频)
- springCloud教学视频
- springboot全套教程2018年2.0版本
- 官网springboot项目
- Spring Boot中自定义注解结合AOP实现主备
- flowable整合Spring
- Spring Security架构以及源码详析
- MyBatis plugin 3.155 (最新版)
评论
共有 条评论