package com.badao.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.badao.pojo.User;
import com.badao.service.UserService;
import com.badao.util.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
// 告诉spring mvc这是一个控制器类
@Controller
@RequestMapping("")
public class UserController {
@Autowired
UserService userService;
@RequestMapping("listUser")
public ModelAndView listUser(Page page){
ModelAndView mav = new ModelAndView();
//根据分页对象,进行查询获取查询对象集合
//List<User> cs= userService.selectAllUser(page);
//int total = userService.total();
//根据总数,计算最后一页的信息
PageHelper.offsetPage(page.getStart(),5);
List<User> cs= userService.selectAllUser();
int total = (int) new PageInfo<>(cs).getTotal();
page.caculateLast(total);
// 放入转发参数
mav.addObject("userList", cs);
// 放入jsp路径
mav.setViewName("listUser");
return mav;
}
@RequestMapping("addUser")
public ModelAndView addUser(User user){
System.out.println(user.getName());
userService.addUser(user);
ModelAndView mav = new ModelAndView("redirect:/listUser");
return mav;
}
@RequestMapping("deleteUser")
public ModelAndView deleteUser(int id){
userService.deleteUser(id);
ModelAndView mav = new ModelAndView("redirect:/listUser");
return mav;
}
@RequestMapping("editUser")
public ModelAndView editUser(User user){
user= userService.selectUser(user.getId());
ModelAndView mav = new ModelAndView("editUser");
mav.addObject("user", user);
return mav;
}
@RequestMapping("updateUser")
public ModelAndView updateUser(User user){
userService.updateUser(user);
ModelAndView mav = new ModelAndView("redirect:/listUser");
return mav;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
SSM整合实现CRUD+Bootstrap源码
共81个文件
jar:29个
xml:8个
java:7个
需积分: 50 10 下载量 129 浏览量
2018-12-21
13:55:12
上传
评论
收藏 11.72MB ZIP 举报
温馨提示
SSM整合实现CRUD+Bootstrap源码
资源推荐
资源详情
资源评论
收起资源包目录
ssmJarTemplateCRUD.zip (81个子文件)
ssmJarTemplateCRUD
.project 914B
WebContent
WEB-INF
jsp
editUser.jsp 647B
listUser.jsp 2KB
lib
servlet-api.jar 193KB
hamcrest-all-1.3.jar 299KB
jackson-core-2.5.4.jar 225KB
spring-test-4.1.6.RELEASE.jar 491KB
spring-core-3.2.16.RELEASE.jar 865KB
spring-test-3.2.16.RELEASE.jar 448KB
jstl-1.2.jar 405KB
spring-aop-3.2.16.RELEASE.jar 331KB
spring-aspects-3.2.16.RELEASE.jar 50KB
junit-4.12.jar 308KB
mysql-connector-java-5.1.6-bin.jar 687KB
spring-web-3.2.16.RELEASE.jar 617KB
spring-webmvc-3.2.16.RELEASE.jar 627KB
jackson-databind-2.5.4.jar 1.09MB
spring-jdbc-3.2.16.RELEASE.jar 397KB
com.springsource.org.aopalliance-1.0.0.jar 5KB
mybatis-spring-1.2.3.jar 50KB
jsqlparser-1.0.jar 356KB
spring-tx-3.2.16.RELEASE.jar 237KB
druid-1.0.15.jar 1.86MB
com.springsource.org.apache.commons.logging-1.1.1.jar 60KB
spring-context-3.2.16.RELEASE.jar 848KB
pagehelper-5.1.0-beta2.jar 79KB
jackson-annotations-2.5.0.jar 39KB
com.springsource.org.apache.log4j-1.2.15.jar 387KB
spring-beans-3.2.16.RELEASE.jar 600KB
fastjson-1.2.7.jar 407KB
mybatis-3.1.1.jar 636KB
spring-expression-3.2.16.RELEASE.jar 192KB
web.xml 2KB
META-INF
MANIFEST.MF 39B
static
bootstrap-3.3.7-dist
js
npm.js 496B
bootstrap.js 70KB
bootstrap.min.js 36KB
fonts
glyphicons-halflings-regular.ttf 44KB
glyphicons-halflings-regular.woff2 18KB
glyphicons-halflings-regular.eot 20KB
glyphicons-halflings-regular.svg 106KB
glyphicons-halflings-regular.woff 23KB
css
bootstrap-theme.min.css.map 25KB
bootstrap-theme.css.map 47KB
bootstrap.min.css.map 529KB
bootstrap.min.css 118KB
bootstrap-theme.min.css 23KB
bootstrap-theme.css 26KB
bootstrap.css.map 380KB
bootstrap.css 149KB
js
jquery-1.12.4.min.js 95KB
src
applicationContext.xml 4KB
com
badao
service
impl
UserServiceImpl.java 1KB
UserService.java 367B
pojo
User.java 442B
controller
UserController.java 2KB
mapper
UserMapper.java 400B
UserMapper.xml 1KB
util
Page.java 911B
test
InsertTest.java 1KB
log4j.properties 377B
springMVC.xml 2KB
.settings
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.common.project.facet.core.xml 345B
org.eclipse.jdt.core.prefs 364B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.core.resources.prefs 57B
org.eclipse.wst.common.component 494B
.jsdtscope 567B
build
classes
applicationContext.xml 4KB
com
badao
service
UserService.class 390B
impl
UserServiceImpl.class 1KB
pojo
User.class 943B
controller
UserController.class 3KB
mapper
UserMapper.class 369B
UserMapper.xml 1KB
util
Page.class 1KB
test
InsertTest.class 1KB
log4j.properties 377B
springMVC.xml 2KB
.classpath 842B
共 81 条
- 1
资源评论
霸道流氓气质
- 粉丝: 1w+
- 资源: 589
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功