ssm框架怎样删除服务器上的文件,SSM框架删除

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

SSM分页查询

后台

1. 实体

package com.ssm.entity;

import java.util.List;

public class PageBean {

private int currentPage;//当前页

private int pageSize;//每页显示的条数

private int totalCount;//数据总数

private int totalSize;//总页数

private List list;//存放返回的数据

public PageBean(){

currentPage = 1;

pageSize = 5;

}

public int getCurrentPage() {

return currentPage;

}

public void setCurrentPage(int currentPage) {

this.currentPage = currentPage;

}

public int getPageSize() {

return pageSize;

}

public void setPageSize(int pageSize) {

this.pageSize = pageSize;

}

public int getTotalCount() {

return totalCount;

}

public void setTotalCount(int totalCount) {

this.totalCount = totalCount;

}

public int getTotalSize() {

return totalSize;

}

public void setTotalSize(int totalSize) {

this.totalSize = totalSize;

}

public List getList() {

return list;

}

public void setList(List list) {

this.list = list;

}

}

2. mapper接口

//分页

public List findAll(Map map);

3. mapper.xml

select * from users limit #{start},#{end}

4. service

//分页

public PageBean findAll(int currentPage);

5. serviceImpl

public PageBean findAll(int currentPage) {

PageBean pb = new PageBean();

Map map =

new HashMap();

if(currentPage<=0){

currentPage = 1;

}

//获取总条数

int totalCount = uMapper.dataCount();

//添加总条数

pb.setTotalCount(totalCount);

//计算总页数

int totalSize=totalCount/pb.getPageSize();

if(totalCount%pb.getPageSize()!=0){

totalSize+=1;

}

//判断当前页是否大于总页数

if(currentPage>=totalSize){

currentPage=totalSize;

}

//添加当前页

pb.setCurrentPage(currentPage);

//添加总页数

pb.setTotalSize(totalSize);

//设置起始值和结束值

map.put("start", (currentPage-1)*pb.getPageSize());

map.put("end", pb.getPageSize());

//获取分页数据

List lu=uMapper.findAll(map);

//赋值给pagebean

pb.setList(lu);

return pb;

}

6. 控制器

@RequestMapping("/fymapping")

public ModelAndView fy(@RequestParam(value="currentPage",defaultValue="1") int currentPage){

ModelAndView mv = new ModelAndView("jsp/fy.jsp");

//当前页不能小于等于0

//如果小于等于0当前页等于1

if(currentPage<=0){

currentPage=1;

}

PageBean pb=uService.findAll(currentPage);

//控制路径中的页数

if(currentPage>=pb.getCurrentPage()){

currentPage= pb.getCurrentPage();

}

int[] index = new int[pb.getTotalSize()];

for (int i = 0; i < index.length; i++) {

index[i]=i+1;

}

mv.addObject("currentPage", currentPage);

mv.addObject("totalSize", index);

mv.addObject("ulist", pb.getList());

return mv;

}

7.访问 页面

点击分页查询

8. 结果页面

批量删除

全选用户编号用户名用户密码用户操作

${u.u_id}${u.u_name}${u.u_pwd}

修改

删除

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值