03总代码

Customer

package cn.itcast.domain;

public class Customer {
    
    /*
     * CREATE TABLE `cst_customer` (
      `cust_id` BIGINT(32) NOT NULL AUTO_INCREMENT COMMENT '客户编号(主键)',
      `cust_name` VARCHAR(32) NOT NULL COMMENT '客户名称(公司名称)',
      `cust_source` VARCHAR(32) DEFAULT NULL COMMENT '客户信息来源',
      `cust_industry` VARCHAR(32) DEFAULT NULL COMMENT '客户所属行业',
      `cust_level` VARCHAR(32) DEFAULT NULL COMMENT '客户级别',
      `cust_linkman` VARCHAR(64) DEFAULT NULL COMMENT '联系人',
      `cust_phone` VARCHAR(64) DEFAULT NULL COMMENT '固定电话',
      `cust_mobile` VARCHAR(16) DEFAULT NULL COMMENT '移动电话',
      PRIMARY KEY (`cust_id`)
    ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
     */
    private Long cust_id;
    
    private String cust_name;
    private String cust_source;
    private String cust_industry;
    private String cust_level;
    private String cust_linkman;
    private String cust_phone;
    private String cust_mobile;
    public Long getCust_id() {
        return cust_id;
    }
    public void setCust_id(Long cust_id) {
        this.cust_id = cust_id;
    }
    public String getCust_name() {
        return cust_name;
    }
    public void setCust_name(String cust_name) {
        this.cust_name = cust_name;
    }
    public String getCust_source() {
        return cust_source;
    }
    public void setCust_source(String cust_source) {
        this.cust_source = cust_source;
    }
    public String getCust_industry() {
        return cust_industry;
    }
    public void setCust_industry(String cust_industry) {
        this.cust_industry = cust_industry;
    }
    public String getCust_level() {
        return cust_level;
    }
    public void setCust_level(String cust_level) {
        this.cust_level = cust_level;
    }
    public String getCust_linkman() {
        return cust_linkman;
    }
    public void setCust_linkman(String cust_linkman) {
        this.cust_linkman = cust_linkman;
    }
    public String getCust_phone() {
        return cust_phone;
    }
    public void setCust_phone(String cust_phone) {
        this.cust_phone = cust_phone;
    }
    public String getCust_mobile() {
        return cust_mobile;
    }
    public void setCust_mobile(String cust_mobile) {
        this.cust_mobile = cust_mobile;
    }
    @Override
    public String toString() {
        return "Customer [cust_id=" + cust_id + ", cust_name=" + cust_name + "]";
    }
    
    
    

}

CustomerAction

package cn.itcast.web.action;

import org.apache.commons.lang3.StringUtils;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

import cn.itcast.domain.Customer;
import cn.itcast.service.CustomerService;
import cn.itcast.utils.PageBean;

public class CustomerAction extends ActionSupport implements ModelDriven<Customer> {
    private Customer customer = new Customer();
    
    private CustomerService cs ;
    
    //利用属性驱动来封装Customer对象没有的属性
    //这样传递Action对象的时候
    private Integer currentPage;
    private Integer  pageSize;

    
    public String list()
    {
        
        //1.封装离线查询对象
        DetachedCriteria dc = DetachedCriteria.forClass(Customer.class);
            //判断并封装参数
        if(StringUtils.isNotBlank(customer.getCust_name()))
        {
            dc.add(Restrictions.like("cust_name", "%"+customer.getCust_name()+"%"));
        }
        //2.调用Service查询分页数据
        PageBean bean = cs.getPageBean(dc, currentPage, pageSize);
        //3.将PageBean放入request域,转发到列表页面显示
                ActionContext.getContext().put("pageBean", bean);
                return "list";
    }
    @Override
    public Customer getModel() {
        return customer;
    }

    public void setCs(CustomerService cs)
    {
        this.cs = cs;
    }

    

    public Integer getCurrentPage()
    {
        return currentPage;
    }


    public void setCurrentPage(Integer currentPage)
    {
        this.currentPage = currentPage;
    }


    public Integer getPageSize()
    {
        return pageSize;
    }


    public void setPageSize(Integer pageSize)
    {
        this.pageSize = pageSize;
    }


    
    
}

applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://www.springframework.org/schema/beans" 
        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-4.2.xsd 
                            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd 
                            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd 
                            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd ">
    
    <!-- 读取db.properties文件 -->
    <context:property-placeholder location="classpath:db.properties" />
    <!-- 配置c3p0连接池 -->
    <bean name="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" >
        <property name="jdbcUrl" value="${jdbc.jdbcUrl}" ></property>
        <property name="driverClass" value="${jdbc.driverClass}" ></property>
        <property name="user" value="${jdbc.user}" ></property>
        <property name="password" value="${jdbc.password}" ></property>
    </bean>
    
    <!-- 核心事务管理器 -->
    <bean name="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager" >
        <property name="sessionFactory" ref="sessionFactory" ></property>
    </bean>
    
    <!-- 配置通知 -->
    <!-- <tx:advice id="txAdvice" transaction-manager="transactionManager" >
        <tx:attributes>
            <tx:method name="save*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false" />
            <tx:method name="persist*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false" />
            <tx:method name="update*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false" />
            <tx:method name="modify*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false" />
            <tx:method name="delete*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false" />
            <tx:method name="remove*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false" />
            <tx:method name="get*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="true" />
            <tx:method name="find*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="true" />
        </tx:attributes>
    </tx:advice> -->
    <!-- 配置将通知织入目标对象
    配置切点
    配置切面 -->
    <!-- <aop:config>
        <aop:pointcut expression="execution(* cn.itcast.service.impl.*ServiceImpl.*(..))" id="txPc"/>
        <aop:advisor advice-ref="txAdvice" pointcut-ref="txPc" />
    </aop:config> -->
    <!-- ========================================================================================= -->
    <!-- 开启注解事务 -->
    <tx:annotation-driven transaction-manager="transactionManager" />
    
    <!-- 将SessionFactory配置到spring容器中 -->
    <!-- 加载配置方案1:仍然使用外部的hibernate.cfg.xml配置信息 -->
    <!-- <bean name="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean" >
        <property name="configLocation" value="classpath:hibernate.cfg.xml" ></property>
    </bean> -->
    <!-- 加载配置方案2:在spring配置中放置hibernate配置信息 -->
    <bean name="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean" >
        <!-- 将连接池注入到sessionFactory, hibernate会通过连接池获得连接 -->
        <property name="dataSource" ref="dataSource" ></property>
        <!-- 配置hibernate基本信息 -->
        <property name="hibernateProperties">
            <props>
                <!--  必选配置 -->
            <!--    <prop key="hibernate.connection.driver_class" >com.mysql.jdbc.Driver</prop>
                <prop key="hibernate.connection.url" >jdbc:mysql:///hibernate_32</prop>
                <prop key="hibernate.connection.username" >root</prop>
                <prop key="hibernate.connection.password" >root</prop> -->
                <prop key="hibernate.dialect" >org.hibernate.dialect.MySQLDialect</prop>
                
                <!--  可选配置 -->
                <prop key="hibernate.show_sql" >true</prop>
                <prop key="hibernate.format_sql" >true</prop>
                <prop key="hibernate.hbm2ddl.auto" >update</prop>
            </props>
        </property>
        <!-- 引入orm元数据,指定orm元数据所在的包路径,spring会自动读取包中的所有配置 -->
        <property name="mappingDirectoryLocations" value="classpath:cn/itcast/domain" ></property>
    </bean>
    
    <!-- action -->
    <!-- 注意:Action对象作用范围一定是多例的.这样才符合struts2架构 -->
    <bean name="userAction" class="cn.itcast.web.action.UserAction" scope="prototype" >
        <property name="userService" ref="userService" ></property>
    </bean>
    
    <bean name="customerAction" class="cn.itcast.web.action.CustomerAction" scope="prototype" >
        <property name="cs" ref="customerService" ></property>
    </bean>
    
    
    
    <!-- service -->
    <bean name="userService" class="cn.itcast.service.impl.UserServiceImpl" >
        <property name="ud" ref="userDao" ></property>
    </bean>
    
    <bean name="customerService" class="cn.itcast.service.impl.CustomerServiceImpl" >
        <property name="cd" ref="customerDao" ></property>
    </bean>
    
    
    
    <!-- dao -->
    <bean name="userDao" class="cn.itcast.dao.impl.UserDaoImpl" >
        <!-- 注入sessionFactory -->
        <property name="sessionFactory" ref="sessionFactory" ></property>
    </bean>
    
    <bean name="customerDao" class="cn.itcast.dao.impl.CustomerDaoImpl" >
        <!-- 注入sessionFactory -->
        <property name="sessionFactory" ref="sessionFactory" ></property>
    </bean>
</beans>

struts.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://www.springframework.org/schema/beans" 
        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-4.2.xsd 
                            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd 
                            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd 
                            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd ">
    
    <!-- 读取db.properties文件 -->
    <context:property-placeholder location="classpath:db.properties" />
    <!-- 配置c3p0连接池 -->
    <bean name="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" >
        <property name="jdbcUrl" value="${jdbc.jdbcUrl}" ></property>
        <property name="driverClass" value="${jdbc.driverClass}" ></property>
        <property name="user" value="${jdbc.user}" ></property>
        <property name="password" value="${jdbc.password}" ></property>
    </bean>
    
    <!-- 核心事务管理器 -->
    <bean name="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager" >
        <property name="sessionFactory" ref="sessionFactory" ></property>
    </bean>
    
    <!-- 配置通知 -->
    <!-- <tx:advice id="txAdvice" transaction-manager="transactionManager" >
        <tx:attributes>
            <tx:method name="save*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false" />
            <tx:method name="persist*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false" />
            <tx:method name="update*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false" />
            <tx:method name="modify*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false" />
            <tx:method name="delete*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false" />
            <tx:method name="remove*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false" />
            <tx:method name="get*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="true" />
            <tx:method name="find*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="true" />
        </tx:attributes>
    </tx:advice> -->
    <!-- 配置将通知织入目标对象
    配置切点
    配置切面 -->
    <!-- <aop:config>
        <aop:pointcut expression="execution(* cn.itcast.service.impl.*ServiceImpl.*(..))" id="txPc"/>
        <aop:advisor advice-ref="txAdvice" pointcut-ref="txPc" />
    </aop:config> -->
    <!-- ========================================================================================= -->
    <!-- 开启注解事务 -->
    <tx:annotation-driven transaction-manager="transactionManager" />
    
    <!-- 将SessionFactory配置到spring容器中 -->
    <!-- 加载配置方案1:仍然使用外部的hibernate.cfg.xml配置信息 -->
    <!-- <bean name="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean" >
        <property name="configLocation" value="classpath:hibernate.cfg.xml" ></property>
    </bean> -->
    <!-- 加载配置方案2:在spring配置中放置hibernate配置信息 -->
    <bean name="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean" >
        <!-- 将连接池注入到sessionFactory, hibernate会通过连接池获得连接 -->
        <property name="dataSource" ref="dataSource" ></property>
        <!-- 配置hibernate基本信息 -->
        <property name="hibernateProperties">
            <props>
                <!--  必选配置 -->
            <!--    <prop key="hibernate.connection.driver_class" >com.mysql.jdbc.Driver</prop>
                <prop key="hibernate.connection.url" >jdbc:mysql:///hibernate_32</prop>
                <prop key="hibernate.connection.username" >root</prop>
                <prop key="hibernate.connection.password" >root</prop> -->
                <prop key="hibernate.dialect" >org.hibernate.dialect.MySQLDialect</prop>
                
                <!--  可选配置 -->
                <prop key="hibernate.show_sql" >true</prop>
                <prop key="hibernate.format_sql" >true</prop>
                <prop key="hibernate.hbm2ddl.auto" >update</prop>
            </props>
        </property>
        <!-- 引入orm元数据,指定orm元数据所在的包路径,spring会自动读取包中的所有配置 -->
        <property name="mappingDirectoryLocations" value="classpath:cn/itcast/domain" ></property>
    </bean>
    
    <!-- action -->
    <!-- 注意:Action对象作用范围一定是多例的.这样才符合struts2架构 -->
    <bean name="userAction" class="cn.itcast.web.action.UserAction" scope="prototype" >
        <property name="userService" ref="userService" ></property>
    </bean>
    
    <bean name="customerAction" class="cn.itcast.web.action.CustomerAction" scope="prototype" >
        <property name="cs" ref="customerService" ></property>
    </bean>
    
    
    
    <!-- service -->
    <bean name="userService" class="cn.itcast.service.impl.UserServiceImpl" >
        <property name="ud" ref="userDao" ></property>
    </bean>
    
    <bean name="customerService" class="cn.itcast.service.impl.CustomerServiceImpl" >
        <property name="cd" ref="customerDao" ></property>
    </bean>
    
    
    
    <!-- dao -->
    <bean name="userDao" class="cn.itcast.dao.impl.UserDaoImpl" >
        <!-- 注入sessionFactory -->
        <property name="sessionFactory" ref="sessionFactory" ></property>
    </bean>
    
    <bean name="customerDao" class="cn.itcast.dao.impl.CustomerDaoImpl" >
        <!-- 注入sessionFactory -->
        <property name="sessionFactory" ref="sessionFactory" ></property>
    </bean>
</beans>

CustomerService

package cn.itcast.service;

import org.hibernate.criterion.DetachedCriteria;

import cn.itcast.utils.PageBean;

public interface CustomerService
{
    //分页业务方法
    PageBean getPageBean(DetachedCriteria dc,Integer currentPage,Integer pageSize);
}

CustomerServiceImpl

package cn.itcast.service.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

import cn.itcast.dao.CustomerDao;
import cn.itcast.domain.Customer;
import cn.itcast.service.CustomerService;
import cn.itcast.utils.PageBean;

public class CustomerServiceImpl implements CustomerService 
{
    private CustomerDao cd;

    @Override
    public PageBean getPageBean(DetachedCriteria dc, Integer currentPage, Integer pageSize)
    {
        //1.调用Dao查询总记录数
        Integer totalCount=cd.getTotalCount(dc);
        //2.创建PageBean对象
        PageBean bean = new PageBean(currentPage, pageSize, totalCount);
        //3.调用Dao查询分页列表数据
        List<Customer> list=cd.getPageList(dc,bean.getStart(),bean.getPageSize());
        //4.列表数据放入到pageBean中,并返回
        bean.setList(list);
        return bean;
    }

    public void setCd(CustomerDao cd)
    {
        this.cd = cd;
    }

}

CustomerDao

package cn.itcast.dao;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

import cn.itcast.domain.Customer;

public interface CustomerDao
{


    Integer getTotalCount(DetachedCriteria dc);

    List<Customer> getPageList(DetachedCriteria cd, int start, Integer pageSize);




}

CustomerDaoImpl

package cn.itcast.dao.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Projections;
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;

import cn.itcast.dao.CustomerDao;
import cn.itcast.domain.Customer;

public class CustomerDaoImpl extends HibernateDaoSupport implements CustomerDao
{

    @Override
    public Integer getTotalCount(DetachedCriteria dc)
    {
        //查询总记录数
        //利用HibernateTemplate来做
        //设置查询的聚合函数,总记录数
        dc.setProjection(Projections.rowCount());
        
        List<Long> list = (List<Long>) getHibernateTemplate().findByCriteria(dc);
        
        
        //清空之前的之前使用过的(dc)离线对象。
        dc.setProjection(null);
        if(list!=null && list.size() >0)
        {
            Long count = list.get(0);
            return count.intValue(); 
        }
        else
        {
            return null;
        }
            
        
    }

    

    @Override
    public List<Customer> getPageList(DetachedCriteria cd, int start, Integer pageSize)
    {
        List<Customer> list=(List<Customer>) getHibernateTemplate().findByCriteria( cd, start, pageSize);
        return list;
    }

}

list.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib  prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<TITLE>客户列表</TITLE> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<LINK href="${pageContext.request.contextPath }/css/Style.css" type=text/css rel=stylesheet>
<LINK href="${pageContext.request.contextPath }/css/Manage.css" type=text/css
    rel=stylesheet>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.4.4.min.js"></script>
<SCRIPT language=javascript>
    function changePage(pageNum){
        //alert(pageNum);测试用

        //1.将页码的值放到隐藏域中
        $("#currentPageInput").val(pageNum);
        //2.提交表单
        $("#pageForm").submit();//表单的id是pageForm
    };
    function changePageSize(pageSize)
    {
        //alert(pageSize);
        //1 将页码的值放入对应表单隐藏域中
        $("#pageSizeInput").val(pageSize);
        //2 提交表单
        $("#pageForm").submit();
    }
    
</SCRIPT>


<META content="MSHTML 6.00.2900.3492" name=GENERATOR>
</HEAD>
<BODY>
    
        
        <TABLE cellSpacing=0 cellPadding=0 width="98%" border=0>
            <TBODY>
                <TR>
                    <TD width=15><IMG src="${pageContext.request.contextPath }/images/new_019.jpg"
                        border=0></TD>
                    <TD width="100%" background="${pageContext.request.contextPath }/images/new_020.jpg"
                        height=20></TD>
                    <TD width=15><IMG src="${pageContext.request.contextPath }/images/new_021.jpg"
                        border=0></TD>
                </TR>
            </TBODY>
        </TABLE>
        <TABLE cellSpacing=0 cellPadding=0 width="98%" border=0>
            <TBODY>
                <TR>
                    <TD width=15 background=${pageContext.request.contextPath }/images/new_022.jpg><IMG
                        src="${pageContext.request.contextPath }/images/new_022.jpg" border=0></TD>
                    <TD vAlign=top width="100%" bgColor=#ffffff>
                        <TABLE cellSpacing=0 cellPadding=5 width="100%" border=0>
                            <TR>
                                <TD class=manageHead>当前位置:客户管理 &gt; 客户列表</TD>
                            </TR>
                            <TR>
                                <TD height=2></TD>
                            </TR>
                        </TABLE>
                        <TABLE borderColor=#cccccc cellSpacing=0 cellPadding=0
                            width="100%" align=center border=0>
                            <TBODY>
                                <TR>
                                    <TD height=25>
                                    <FORM id="pageForm" name="customerForm"
                                    action="${pageContext.request.contextPath }/CustomerAction_list"
                                        method=post>
                                        <!-- 隐藏域.当前页码 -->
                                        <input type="hidden" name="currentPage" id="currentPageInput" value="<s:property value="#pageBean.currentPage" />" />
                                        <!-- 隐藏域.每页显示条数 -->
                                        <input type="hidden" name="pageSize" id="pageSizeInput" value="<s:property value="#pageBean.pageSize" />" />
                                        <TABLE cellSpacing=0 cellPadding=2 border=0>
                                            <TBODY>
                                                <TR>
                                                    <TD>客户名称:</TD>
                                                    <TD><INPUT class=textbox id=sChannel2
                                                        style="WIDTH: 80px" maxLength=50 name="cust_name" value="${param.cust_name}"></TD>
                                                    
                                                    <TD><INPUT class=button id=sButton2 type=submit
                                                        value=" 筛选 " name=sButton2></TD>
                                                </TR>
                                            </TBODY>
                                        </TABLE>
                                        </FORM>
                                    </TD>
                                </TR>
                                
                                <TR>
                                    <TD>
                                        <TABLE id=grid
                                            style="BORDER-TOP-WIDTH: 0px; FONT-WEIGHT: normal; BORDER-LEFT-WIDTH: 0px; BORDER-LEFT-COLOR: #cccccc; BORDER-BOTTOM-WIDTH: 0px; BORDER-BOTTOM-COLOR: #cccccc; WIDTH: 100%; BORDER-TOP-COLOR: #cccccc; FONT-STYLE: normal; BACKGROUND-COLOR: #cccccc; BORDER-RIGHT-WIDTH: 0px; TEXT-DECORATION: none; BORDER-RIGHT-COLOR: #cccccc"
                                            cellSpacing=1 cellPadding=2 rules=all border=0>
                                            <TBODY>
                                                <TR
                                                    style="FONT-WEIGHT: bold; FONT-STYLE: normal; BACKGROUND-COLOR: #eeeeee; TEXT-DECORATION: none">
                                                    <TD>客户名称</TD>
                                                    <TD>客户级别</TD>
                                                    <TD>客户来源</TD>
                                                    <TD>联系人</TD>
                                                    <TD>电话</TD>
                                                    <TD>手机</TD>
                                                    <TD>操作</TD>
                                                </TR>
                                                <s:iterator value="#pageBean.list" var="cust" >
                                                <TR         
                                                    style="FONT-WEIGHT: normal; FONT-STYLE: normal; BACKGROUND-COLOR: white; TEXT-DECORATION: none">
                                                    <TD>
                                                        <s:property value="#cust.cust_name" />
                                                    </TD>
                                                    <TD>
                                                    <s:property value="#cust.cust_level" />
                                                    </TD>
                                                    <TD>
                                                    <s:property value="#cust.cust_source" />
                                                    </TD>
                                                    <TD>
                                                    <s:property value="#cust.cust_linkman" />
                                                    </TD>
                                                    <TD>
                                                    <s:property value="#cust.cust_phone" />
                                                    </TD>
                                                    <TD>
                                                    <s:property value="#cust.cust_mobile" />
                                                    </TD>
                                                    <TD>
                                                    <a href="${pageContext.request.contextPath }/customerServlet?method=edit&custId=${customer.cust_id}">修改</a>
                                                    &nbsp;&nbsp;
                                                    <a href="${pageContext.request.contextPath }/customerServlet?method=delete&custId=${customer.cust_id}">删除</a>
                                                    </TD>
                                                </TR>
                                                </s:iterator>
                                            

                                            </TBODY>
                                        </TABLE>
                                    </TD>
                                </TR>
                                
                                <TR>
                                    <TD><SPAN id=pagelink>
                                            <DIV style="LINE-HEIGHT: 20px; HEIGHT: 20px; TEXT-ALIGN: right">
                                            共[<B><s:property value="#pageBean.totalCount" /> </B>]条记录,[<B><s:property value="#pageBean.totalPage" /></B>]页
                                                ,每页显示 <%-- changePageSize($('#pageSizeSelect option').filter(':selected').val()) --%> 
                                                
                                                <!-- onchange事件----变化之后才触发 -->
                                                <select name="pageSize" onchange="changePageSize($('#pageSizeSelect option:selected').val())" id="pageSizeSelect" >
                                                    <option value="3" <s:property value="#pageBean.pageSize==3?'selected':''" /> >3</option>
                                                    <option value="5" <s:property value="#pageBean.pageSize==5?'selected':''" /> >5</option>
                                                </select>
                                                条
                                                [<A href="javaScript:void(0)" onclick="changePage(<s:property value='#pageBean.currentPage-1' />)" >前一页</A>]
                                                <B><s:property value="#pageBean.currentPage" /></B>
                                                [<A href="javaScript:void(0)" onclick="changePage(<s:property value='#pageBean.currentPage+1' />)"  >后一页</A>] 
                                                到
                                                <input type="text" size="3" id="page" name="page" value="<s:property value="#pageBean.currentPage" />"  />
                                                页
                                                
                                                <input type="button" value="Go" onclick="changePage($('#page').val())"/>
                                            </DIV>
                                    </SPAN></TD>
                                </TR>
                            </TBODY>
                        </TABLE>
                    </TD>
                    <TD width=15 background="${pageContext.request.contextPath }/images/new_023.jpg"><IMG
                        src="${pageContext.request.contextPath }/images/new_023.jpg" border=0></TD>
                </TR>
            </TBODY>
        </TABLE>
        <TABLE cellSpacing=0 cellPadding=0 width="98%" border=0>
            <TBODY>
                <TR>
                    <TD width=15><IMG src="${pageContext.request.contextPath }/images/new_024.jpg"
                        border=0></TD>
                    <TD align=middle width="100%"
                        background="${pageContext.request.contextPath }/images/new_025.jpg" height=15></TD>
                    <TD width=15><IMG src="${pageContext.request.contextPath }/images/new_026.jpg"
                        border=0></TD>
                </TR>
                
            </TBODY>
        </TABLE>
    
</BODY>
</HTML>

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 151,829评论 1 331
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 64,603评论 1 273
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 101,846评论 0 226
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 42,600评论 0 191
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 50,780评论 3 272
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 39,695评论 1 192
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,136评论 2 293
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 29,862评论 0 182
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 33,453评论 0 229
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 29,942评论 2 233
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 31,347评论 1 242
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 27,790评论 2 236
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 32,293评论 3 221
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 25,839评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,448评论 0 181
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 34,564评论 2 249
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 34,623评论 2 249

推荐阅读更多精彩内容

  • 1. Java基础部分 基础部分的顺序:基本语法,类相关的语法,内部类的语法,继承相关的语法,异常的语法,线程的语...
    子非鱼_t_阅读 31,275评论 18 399
  • 一. Java基础部分.................................................
    wy_sure阅读 3,724评论 0 11
  • 概述 什么是Struts2的框架Struts2是Struts1的下一代产品,是在 struts1和WebWork的...
    inke阅读 2,172评论 0 50
  • 转载至:http://www.cnblogs.com/cvst/p/5822373.html Java Excep...
    小沙鹰168阅读 1,837评论 0 3
  • 关于自我反省、自我寻找,和自我组建。 A 小a是一只洋葱。他喜欢结交朋友,同类或异类。 其中有一只火龙果,发型酷酷...
    蓝籽阅读 476评论 2 3