Task_listMapper.xml文件:




 
   
   
   
   
   
   
   
   
 


 
   
   
   

**************************

com.chinaGPS.song.dao.MemberDao

public class MemberDao extends BaseMyBatisDao{

 /**
    * 获取 下载 任务列表 分页
 * @param pageRequest
 * @return
 */
public Page getTaskList(PageRequest pageRequest){
       Page page = pageQuery(pageRequest);
       return page;
   }

***********************

package com.chinaGPS.song.service;
import java.util.List;
import com.chinaGPS.song.pojo.Task_list;
import com.chinaGPS.song.util.page.Page;
import com.chinaGPS.song.util.page.PageRequest;
public interface TaskInfoService {
    public ListselectTaskList();
   
    /**
     * 获取分页下载 任务列表
     * @return
     */
    Page getAllTaskList(PageRequest pageRequest);
}

}

*********************

package com.chinaGPS.song.util.page;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 分页请求信息
 * 其中范型为filters的类型
 * @author badqiu
 */
public class PageRequest implements Serializable {

    /**
     * 过滤参数
     */
    private T filters;
    /**
     * 页号码,页码从1开始
     */
    private int pageNumber;
    /**
     * 分页大小
     */
    private int pageSize;
    /**
     * 排序的多个列,如: username desc
     */
    private String sortColumns;
   
    public PageRequest() {
        this(0,0);
    }
   
    public PageRequest(T filters) {
        this(0,0,filters);
    }
   
    public PageRequest(int pageNumber, int pageSize) {
        this(pageNumber,pageSize,(T)null);
    }
   
    public PageRequest(int pageNumber, int pageSize, T filters) {
        this(pageNumber,pageSize,filters,null);
    }
   
    public PageRequest(int pageNumber, int pageSize,String sortColumns) {
        this(pageNumber,pageSize,null,sortColumns);
    }
   
    public PageRequest(int pageNumber, int pageSize, T filters,String sortColumns) {
        this.pageNumber = pageNumber;
        this.pageSize = pageSize;
        setFilters(filters);
        setSortColumns(sortColumns);
    }

    public T getFilters() {
        return filters;
    }

    public void setFilters(T filters) {
        this.filters = filters;
    }

    public int getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(int pageNumber) {
        this.pageNumber = pageNumber;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }
   
    public String getSortColumns() {
        return sortColumns;
    }
    /**
     * 排序的列,可以同时多列,使用逗号分隔,如 username desc,age asc
     * @return
     */
    public void setSortColumns(String sortColumns) {
        this.sortColumns = sortColumns;
    }
    /**
     * 将sortColumns进行解析以便返回SortInfo以便使用
     * @return
     */
    public List getSortInfos() {
        return Collections.unmodifiableList(SortInfo.parseSortColumns(sortColumns));
    }   
}
**********************

package com.chinaGPS.song.service.impl;
import java.util.List;
import com.chinaGPS.song.dao.MemberDao;
import com.chinaGPS.song.pojo.Task_list;
import com.chinaGPS.song.service.TaskInfoService;
import com.chinaGPS.song.util.page.Page;
import com.chinaGPS.song.util.page.PageRequest;

public class TaskInfoServiceImpl implements TaskInfoService {

    private MemberDao memberDao;
   
    public MemberDao getMemberDao() {
        return memberDao;
    }

    public void setMemberDao(MemberDao memberDao) {
        this.memberDao = memberDao;
    }  
    /* (non-Javadoc)
     * @see com.chinaGPS.song.service.TaskInfoService#getAllSongList(com.chinaGPS.song.util.page.PageRequest)
     */ 
    public Page getAllTaskList(PageRequest pageRequest) {
        return memberDao.getTaskList(pageRequest);
       
    }

}
************************

package com.chinaGPS.song.action.sysmanage;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpSession;
import org.apache.commons.lang.StringUtils;
import org.apache.struts2.ServletActionContext;
import org.displaytag.tags.TableTagParameters;
import org.displaytag.util.ParamEncoder;
import com.chinaGPS.song.action.BaseAction;
import com.chinaGPS.song.pojo.Song_info;
import com.chinaGPS.song.pojo.Task_list;
import com.chinaGPS.song.service.TaskInfoService;
import com.chinaGPS.song.util.page.Page;
import com.chinaGPS.song.util.page.PageRequest;
public class TaskListAction extends BaseAction {
    private static final long serialVersionUID = -1209389500331569006L;
    private TaskInfoService taskInfoService;
    private List list;
    private PageRequest pageRequest;
    private int pageSize = 5;
    private int startPage = 1;
    private int pageNumbers;
    public String songsTaskList() {
        String pageIndexName = new ParamEncoder("row")
        .encodeParameterName(TableTagParameters.PARAMETER_PAGE); // 页数的参数名
        startPage = StringUtils.isBlank(getParameter(pageIndexName)) ? 1
        : (Integer.parseInt(getParameter(pageIndexName))); // 当前页数
       
        if (startPage == 0) {
            startPage = 1;
        }
        if(pageRequest==null)
            pageRequest = new PageRequest(new HashMap());
        pageRequest.setPageNumber(startPage);
        pageRequest.setPageSize(pageSize);
        pageRequest.setSortColumns(null);
       

        Page page = taskInfoService.getAllTaskList(pageRequest);
        list = page.getResult();
        pageNumbers = page.getTotalCount();
        return SUCCESS;
    }
    public TaskInfoService getTaskInfoService() {
        return taskInfoService;
    }
    public PageRequest getPageRequest() {
        return pageRequest;
    }
    public void setPageRequest(PageRequest pageRequest) {
        this.pageRequest = pageRequest;
    }
    public int getPageSize() {
        return pageSize;
    }
    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }
    public int getStartPage() {
        return startPage;
    }
   public void setStartPage(int startPage) {
        this.startPage = startPage;
    }
    public int getPageNumbers() {
        return pageNumbers;
    }
    public void setPageNumbers(int pageNumbers) {
        this.pageNumbers = pageNumbers;
    }
    public void setTaskInfoService(TaskInfoService taskInfoService) {
        this.taskInfoService = taskInfoService;
    }
    public List getList() {
        return list;
    }
    public void setList(List list) {
        this.list = list;
    }      
}
************************JSP

<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>

                                                pagesize="${pageSize}" size="${pageNumbers}"
                                                requestURI="songsTaskList.action"  class="table">
                                               
                                               
                                               
                                               
                                               
                                               
                                               
   

                 

  删除
 

 
 

**********************application-action-sys.xml


       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
           default-autowire="byName">     
      
          
      

***********************application-dao.xml


       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
           default-autowire="byName">        
   
       
   
        

******************application-core.xml


    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans  
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-3.0.xsd  
           http://www.springframework.org/schema/aop
           http://www.springframework.org/schema/aop/spring-aop-3.0.xsd  
           http://www.springframework.org/schema/tx
           http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
    default-autowire="byName">


   
   

   

   
       
       
       
       
   


   
   
   
   

   
   
   
   
            class="com.chinaGPS.song.util.SqlSessionFactoryFactoryBean">
       
       
            
                 classpath*:/com/chinaGPS/song/mapper/Song_infoMapper.xml
                 classpath*:/com/chinaGPS/song/mapper/Song_singerMapper.xml
                 classpath*:/com/chinaGPS/song/mapper/Task_listMapper.xml
            

       

       
   



   
   
   
   
   






   
   
   
   

   
   
   
   



   
            class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
       
   


   
   
       
           
           
           
           
           
           
           
           
           
           
           
           
       

   

   
   
       
       
       
       
       
       
       
       
   


*********************application-service.xml


       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
           default-autowire="byName">