利用ssm框架做一個客戶管理系統


1. 需求分析 

 

(1)初始化查詢條件下拉列表

  

(2)展示客戶列表,並且可以根據查詢條件過濾查詢結果,並且實現分頁處理。

(3)修改客戶信息

  

  1)點擊客戶列表中的“修改”按鈕彈出客戶信息修改對話框,並初始化客戶信息;

  2)點擊“保存修改”按鈕將修改后的結果保存到數據庫中。

 (4)刪除客戶

  點擊客戶列表中的刪除按鈕,提示“警告信息”:

  

  點擊確定后刪除用戶信息,並刷新頁面。

 

 2. 數據庫表 

 

客戶表customer

字典查詢表base_dict

 

 3. 工程搭建(SSM整合)

(1)Dao層

    pojo和映射文件以及接口手動編寫

    SqlMapConfig.xml  : mybatis核心配置文件

    ApplicationContext-dao.xml 整合后spring在dao層的配置:數據源、會話工廠、掃描Mapper

(2)service層
    事務            ApplicationContext-trans.xml

    @Service注解掃描    ApplicationContext-service.xml

(3)controller層
    SpringMvc.xml :

        注解掃描:掃描@Controller注解

        注解驅動:替我們顯示的配置了最新版的處理器映射器和處理器適配器

        視圖解析器:顯示的配置是為了在controller中不用每個方法都寫頁面的全路徑

(4)web.xml

    springMvc前端控制器配置

    spring監聽

 java類結構:

Springmvc、spring、mybatis框架整合:

  所有配置文件放在一個config文件夾內,注意config要建成源文件夾(右鍵src --> new --> Source Folder),這樣就可以直接用 classpath:指向要訪問的這幾個文件(因為源文件夾最后都會被加到classes目錄里)。

(1)SqlMapConfig.xml :(不寫內容)

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    
</configuration>

(2)ApplicationContext-dao.xml :整合后spring在dao層的配置:數據源、會話工廠、掃描Mapper

  <!-- 加載配置文件 -->
    <context:property-placeholder location="classpath:db.properties" />
    <!-- 數據庫連接池 -->
    <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
        destroy-method="close">
        <property name="driverClassName" value="${jdbc.driver}" />
        <property name="url" value="${jdbc.url}" />
        <property name="username" value="${jdbc.username}" />
        <property name="password" value="${jdbc.password}" />
    </bean>
    
    <!-- mapper配置 -->
    <!-- 讓spring管理sqlsessionfactory 使用mybatis和spring整合包中的 -->
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <!-- 數據庫連接池 -->
        <property name="dataSource" ref="dataSource" />
        <!-- 加載mybatis的全局配置文件 -->
        <property name="configLocation" value="classpath:SqlMapConfig.xml" />
    </bean>
    
    <!-- 配置Mapper掃描器 -->
    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="com.ztt.dao"/>
    </bean>

(3)ApplicationContext-service.xml :配置@Service注解掃描

  <!-- @Service掃描 -->
    <context:component-scan base-package="com.ztt.service"></context:component-scan>

(4)ApplicationContext-trans.xml :配置事務

  <!-- 事務管理器 -->
    <bean id="transactionManager"
        class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <!-- 數據源 -->
        <property name="dataSource" ref="dataSource" />
    </bean>
    
    <!-- 通知 -->
    <tx:advice id="txAdvice" transaction-manager="transactionManager">
        <tx:attributes>
            <!-- 傳播行為 -->
            <tx:method name="save*" propagation="REQUIRED" />
            <tx:method name="insert*" propagation="REQUIRED" />
            <tx:method name="delete*" propagation="REQUIRED" />
            <tx:method name="update*" propagation="REQUIRED" />
            <tx:method name="find*" propagation="SUPPORTS" read-only="true" />
            <tx:method name="get*" propagation="SUPPORTS" read-only="true" />
        </tx:attributes>
    </tx:advice>
    
    <!-- 切面 -->
    <aop:config>
        <aop:advisor advice-ref="txAdvice"
            pointcut="execution(* com.ztt.service.*.*(..))" />
    </aop:config>

【注】ApplicationContext-dao.xml 、ApplicationContext-service.xml、ApplicationContext-trans.xml也可以寫到一個ApplicationContext.xml中。

(5)SpringMvc.xml:(MyBatis的配置文件),配置@Controller注解掃描、注解驅動(處理映射器和處理適配器)、視圖解析器。

  <!-- @Controller注解掃描 -->
    <context:component-scan base-package="cn.ztt.controller"></context:component-scan>
    
    <!-- 注解驅動: 替我們顯示的配置了最新版的注解的處理器映射器和處理器適配器 -->
    <mvc:annotation-driven conversion-service="conversionService"></mvc:annotation-driven>
    
    <!-- 配置視圖解析器 
    作用:在controller中指定頁面路徑的時候就不用寫頁面的完整路徑名稱了,可以直接寫頁面去掉擴展名的名稱
    -->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <!-- 真正的頁面路徑 =  前綴 + 去掉后綴名的頁面名稱 + 后綴 -->
        <!-- 前綴 -->
        <property name="prefix" value="/WEB-INF/jsp/"></property>
        <!-- 后綴 -->
        <property name="suffix" value=".jsp"></property>
    </bean>
    
<!-- 配置自定義轉換器 注意: 一定要將自定義的轉換器配置到注解驅動上 --> <bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean"> <property name="converters"> <set> <!-- 指定自定義轉換器的全路徑名稱 CustomerGlobalStrToDataConverter是我們自己寫的一個類,實現日期轉換--> <bean class="com.ztt.controller.converter.CustomGlobalStrToDateConverter"/> </set> </property> </bean>

(6)Web.xml:配置spring監聽、springmvc前端控制器(攔截所有.action文件)、Post請求亂碼

   <!-- 加載spring容器 -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:ApplicationContext-*.xml</param-value>
    </context-param>
  <!-- Spring監聽器 -->
  <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- springmvc前端控制器 --> <servlet> <servlet-name>springMvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:SpringMvc.xml</param-value> </init-param> <!-- 在tomcat啟動的時候就加載這個servlet --> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springMvc</servlet-name> <!-- *.action 代表攔截后綴名為.action結尾的 / 攔截所有但是不包括.jsp /* 攔截所有包括.jsp --> <url-pattern>*.action</url-pattern> </servlet-mapping> <!-- 配置Post請求亂碼 --> <filter> <filter-name>CharacterEncodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>utf-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>CharacterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>

(7)加入jsp:

 

4. 實現1:查詢條件初始化 

 

  • 客戶來源、所屬行業、客戶級別分別對象表base_dict中的 dict_type_code=002、001、006

  實際操作中我們不要傳入這些模糊數字,可以建一個properties資源文件,然后將這些數字與所代表的含義通過 鍵-值映射 存儲。

  建立resource.properties資源文件:

customer.dict.source=002
customer.dict.industry=001
customer.dict.level=006

  然后在 SpringMvc中引入該文件:

   <!-- 引入字典資源文件 -->
    <context:property-placeholder location="classpath:resource.properties"/>

 

由controller層調用service層,service層調用dao層,dao層來操作數據庫 。下面由DAO->service->controler我們來編寫代碼:

(1)DAO層

  cn.ztt.dao包下 :(一個表對應一個mapper,我們用customer、base_dict這兩個表,所以建2個mapper)

      

1)DictMapper.xml 編寫數據庫查詢:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.ztt.dao.DictMapper">
    <select id="findDictByCode" parameterType="String" resultType="com.ztt.pojo.BaseDict">
        select * from base_dict b where b.dict_enable=1 and b.dict_type_code=#{code} order by b.dict_sort
    </select>
</mapper>

2)DictMapper接口 上定義 findDictByCode 方法

public interface DictMapper {
    public List<BaseDict> findDictByCode(String code);
}

(2)service層

   

3)在service層實現 findDictByCode 方法:

  先在CustomerService(接口)上編寫 findDictByCode 方法

public interface CustomerService {
    public List<BaseDict> findDictByCode(String code);
}

  然后在 CustomerServiceImpl 實現類上實現該方法。注意類上要加@Service注解:

@Service
public class CustomerServiceImpl implements CustomerService {
    
    //因為下面要調用DAO的方法,所以把DAO層的DictMapper傳進來
@Autowired
private DictMapper dictMapper;
    
    @Override
    public List<BaseDict> findDictByCode(String code) {
        List<BaseDict> list = dictMapper.findDictByCode(code);
        return list;
    }
}

(3)Controller層

 4)在 CustomerController.java類上調用service層的方法實現:

@Controller
@RequestMapping("/customer")
public class CustomerController {

    @Autowired     private CustomerService customerService;
    
    //讀取resource.properties中的鍵並設置名稱
    @Value("${customer.dict.source}")
    private String source;
    @Value("${customer.dict.industry}")
    private String industry;
    @Value("${customer.dict.level}")
    private String level;
    
    //接收QueryVo對象是為了數據回顯,接收Model是為了向頁面傳入參數
    @RequestMapping("/list")
    public String list(QueryVo vo, Model model) throws Exception {
        //客戶來源 
        List<BaseDict> sourceList = customerService.findDictByCode(source);
        //客戶行業
        List<BaseDict> industryList = customerService.findDictByCode(industry);
        //客戶級別
        List<BaseDict> levelList = customerService.findDictByCode(level);
        
        //發送的是get請求,這里要處理get請求亂碼,沒有解決!
        /*if(vo.getCustName() != null){
            vo.setCustName(new String(vo.getCustName().getBytes("iso8859-1"),"utf-8"));
        }*/
        
        //將信息響應給頁面, 頁面上分別使用${fromType}、${industryType}、${levelType}接收
        //高級查詢下拉列表數據
        model.addAttribute("fromType", sourceList);
        model.addAttribute("industryType", industryList);
        model.addAttribute("levelType", levelList);
        
        //QueryVo中封裝了custName、custSource、custIndustry、custLevel這幾個屬性
        //高級查詢選中數據回顯
        model.addAttribute("custName", vo.getCustName());
        model.addAttribute("custSource", vo.getCustSource());
        model.addAttribute("custIndustry", vo.getCustIndustry());
        model.addAttribute("custLevel", vo.getCustLevel());

     return "customer"; } }

 

上面采用 vo.setCustName(new String(vo.getCustName().getBytes("iso8859-1"),"utf-8")); 的方法沒有解決亂碼問題:

在輸入中文后中文變成了問號:

后來選了另一種方式解決:直接修改tomcat的編碼方式:在conf文件夾下的server.xml 文件里指定編碼格式為UTF-8

<Connector port="8275" protocol="HTTP/1.1" connectionTimeout="20000" maxHttpHeaderSize ="10240" redirectPort="8443"URIEncoding="UTF-8"/>

 

 

 5. 實現2:展示客戶列表,並且可以根據查詢條件過濾查詢結果,並且實現分頁處理

 首先看下 QueryVo類 :

public class QueryVo {

    private String custName;    //客戶名稱
    private String custSource;  //客戶來源 
    private String custIndustry;//客戶行業
    private String custLevel;   //客戶級別
    //分頁屬性
    private Integer page = 1;   //當前第幾頁,默認是第1頁
    private Integer start;      //這一頁從第幾個記錄開始
    private Integer size = 10;  //一頁有幾條記錄,默認10條

        set/get.......
}

在得到查詢條件后,我們傳入QueryVo對象進行客戶列表查詢。

 (1)DAO層

 1)CustomerMapper.xml 編寫數據庫查詢 :

   根據QueryVo對象編寫 findCustomerByVo(查詢客戶列表)、findCustomerByVoCount(查詢客戶數):

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.ztt.dao.CustomerMapper">

    <sql id="customer_where">
        <where>
            <if test="custName != null and custName != ''">
                and a.cust_name like '%${custName}%'
            </if>
            <if test="custSource != null and custSource != ''">
                and a.cust_source=#{custSource}
            </if>
            <if test="custIndustry != null and custIndustry != ''">
                and a.cust_industry=#{custIndustry}
            </if>
            <if test="custLevel != null and custLevel != ''">
                and a.cust_level=#{custLevel}
            </if>
        </where>
    </sql>

    <select id="findCustomerByVo" parameterType="com.ztt.pojo.QueryVo" resultType="com.ztt.pojo.Customer">
        select a.cust_id,a.cust_name, b.dict_item_name cust_source, c.dict_item_name cust_industry, 
            d.dict_item_name cust_level,a.cust_phone,a.cust_mobile, a.cust_linkman, a.cust_zipcode, 
            a.cust_address, a.cust_createtime
        from customer a
        left join base_dict b on a.cust_source = b.dict_id
        left join base_dict c on a.cust_industry = c.dict_id
        left join base_dict d on a.cust_level = d.dict_id
        
        <include refid="customer_where"></include>
        limit #{start}, #{size}
    </select>
    
    <select id="findCustomerByVoCount" parameterType="com.ztt.pojo.QueryVo" resultType="int">
        select count(*)
        from customer a
        left join base_dict b on a.cust_source = b.dict_id
        left join base_dict c on a.cust_industry = c.dict_id
        left join base_dict d on a.cust_level = d.dict_id
        
        <include refid="customer_where"></include>
    </select>

</mapper>

 2) DictMapper類 上定義 findCustomerByVo、findCustomerByVoCount方法:

public interface CustomerMapper {
    //查詢客戶列表
    public List<Customer> findCustomerByVo(QueryVo vo);
    //查詢客戶人數
    public Integer findCustomerByVoCount(QueryVo vo);  
}

(2)Service層

3)在service層實現 findCustomerByVo、findCustomerByVoCount方法:

  先在CustomerService(接口)上編寫 findCustomerByVo、findCustomerByVoCount 方法

    public List<Customer> findCustomerByVo(QueryVo vo);
    public Integer findCustomerByVoCount(QueryVo vo);    

  然后在 CustomerServiceImpl 實現類上實現這兩個方法:

@Service
public class CustomerServiceImpl implements CustomerService {
    
    @Autowired
    private DictMapper dictMapper;
    @Autowired     private CustomerMapper customerMapper;
    
    @Override
    public List<BaseDict> findDictByCode(String code) {
        List<BaseDict> list = dictMapper.findDictByCode(code);
        return list;
    }
    
    @Override
    public List<Customer> findCustomerByVo(QueryVo vo) {
        List<Customer> list = customerMapper.findCustomerByVo(vo);
        return list;
    }
    @Override
    public Integer findCustomerByVoCount(QueryVo vo) {
        Integer count = customerMapper.findCustomerByVoCount(vo);
        return count;
    }
}

(3)Controller層

 4)在 CustomerController.java類上調用service層的方法實現:

@Controller
@RequestMapping("/customer")
public class CustomerController {

    @Autowired
    private CustomerService customerService;
    
    //讀取resource.properties中的鍵並設置名稱
    @Value("${customer.dict.source}")
    private String source;
    @Value("${customer.dict.industry}")
    private String industry;
    @Value("${customer.dict.level}")
    private String level;
    
    //接收QueryVo對象是為了數據回顯,接收Model是為了向頁面傳入參數
    @RequestMapping("/list")
    public String list(QueryVo vo, Model model) throws Exception {
        //客戶來源 
        List<BaseDict> sourceList = customerService.findDictByCode(source);
        //客戶行業
        List<BaseDict> industryList = customerService.findDictByCode(industry);
        //客戶級別
        List<BaseDict> levelList = customerService.findDictByCode(level);
        //默認當前頁為1
        if(vo.getPage() == null){         vo.setPage(1);      }      //設置查詢的起始記錄條數
        vo.setStart((vo.getPage() - 1) * vo.getSize());
     //查詢數據列表和數據總數 List<Customer> resultList = customerService.findCustomerByVo(vo);     Integer count = customerService.findCustomerByVoCount(vo);
     //page是我們自己寫的封裝分頁的類,將查詢結果封裝到該類中 Page<Customer> page = new Page<Customer>();      page.setTotal(count); //數據總數 page.setSize(vo.getSize());//每頁顯示條數 page.setPage(vo.getPage());//當前頁數 page.setRows(resultList); //數據列表      //將查詢結果返回給頁面 model.addAttribute("page", page);
     //將信息響應給頁面, 頁面上分別使用${fromType}、${industryType}、${levelType}接收 //高級查詢下拉列表數據 model.addAttribute("fromType", sourceList); model.addAttribute("industryType", industryList); model.addAttribute("levelType", levelList); //QueryVo中封裝了custName、custSource、custIndustry、custLevel這幾個屬性 //高級查詢選中數據回顯 model.addAttribute("custName", vo.getCustName()); model.addAttribute("custSource", vo.getCustSource()); model.addAttribute("custIndustry", vo.getCustIndustry()); model.addAttribute("custLevel",vo.getCustLevel());
     return "customer"; } }

效果:

 

6.實現3:修改客戶信息 

6.1 點擊客戶列表中的“修改”按鈕彈出客戶信息修改對話框,並初始化客戶信息:

 

思路:一點擊修改就提交controller,交給controller一個id(這條記錄的id),然后根據這條記錄的id查詢這條記錄的詳細信息,把數據返回回來。

(1)DAO層:

  在 CustomerMapper.xml 編寫 根據id查詢用戶信息的sql語句:

  <select id="findCustomerById" parameterType="long" resultType="com.ztt.pojo.Customer">
        select * from customer where cust_id=#{id}
    </select>

  在CustomerMapper.java 接口編寫 findCustomerById 方法:

  //根據id查詢客戶信息
    public Customer findCustomerById(Long id); 

(2)Service層:

  先在CustomerService(接口)上編寫 findCustomerBId 方法:

    public Customer findCustomerById(Long id); 

  然后在CustomerServiceImpl 實現類上實現這個方法:

    @Autowired
    private CustomerMapper customerMapper;
    
    @Override
    public Customer findCustomerById(Long id) {
        Customer customer = customerMapper.findCustomerById(id);
        return customer;
    }

 

(3)Controller層:

    @Autowired
    private CustomerService customerService;
    
    @RequestMapping("/detail")
    @ResponseBody  //將Java類自動轉為json數據 public Customer detail(Long id) throws Exception{
        Customer customer = customerService.findCustomerById(id);
        return customer;
    }

 

customer.jsp相對應的:

。。。。。。
<a href="#" 。。。。。。 onclick="editCustomer(${row.cust_id})">修改</a>
。。。。。。
<script type="text/javascript"> function editCustomer(id) { $.ajax({ type:"get", url:"<%=basePath%>customer/detail.action", data:{"id":id}, success:function(data) { $("#edit_cust_id").val(data.cust_id); $("#edit_customerName").val(data.cust_name); $("#edit_customerFrom").val(data.cust_source) $("#edit_custIndustry").val(data.cust_industry) $("#edit_custLevel").val(data.cust_level) $("#edit_linkMan").val(data.cust_linkman); $("#edit_phone").val(data.cust_phone); $("#edit_mobile").val(data.cust_mobile); $("#edit_zipcode").val(data.cust_zipcode); $("#edit_address").val(data.cust_address); } }); }
</script>

 

效果:點擊修改后彈出客戶信息修改對話框,並初始化了客戶信息:

    

 

6.2 點擊“保存修改”按鈕將修改后的結果保存到數據庫中。

 (1)DAO層:

  在 CustomerMapper.xml 編寫 修改 的sql語句:

  <update id="updateCustomerById" parameterType="com.ztt.pojo.Customer">
        update customer 
        <!-- set標簽作用:第一可以自動添加set關鍵字, 第二可以去掉最后一個更新的逗號 -->
        <set>
            <if test="cust_name != null and  cust_name != ''">
                cust_name=#{cust_name} ,
            </if>
            <if test="cust_source != null and cust_source  != ''">
                cust_source=#{cust_source},
            </if>
            <if test="cust_industry != null and  cust_industry != ''">
                cust_industry=#{cust_industry},
            </if>
            <if test="cust_level != null and  cust_level != ''">
                cust_level=#{cust_level},
            </if>
            <if test="cust_linkman != null and  cust_linkman != ''">
                cust_linkman=#{cust_linkman},
            </if>
            <if test=" cust_phone != null and  cust_phone != ''">
                cust_phone=#{cust_phone},
            </if>
            <if test="cust_mobile != null and cust_mobile  != ''">
                cust_mobile=#{cust_mobile},
            </if>
            <if test="cust_zipcode != null and  cust_zipcode != ''">
                cust_zipcode=#{cust_zipcode},
            </if>
            <if test="cust_address != null and   cust_address!= ''">
                cust_address=#{cust_address},
            </if>
        </set>
        where cust_id=#{cust_id}
    </update>

  在CustomerMapper.java 接口編寫 updateCustomerById 方法:

    //修改客戶信息
    public void updateCustomerById(Customer customer);

(2)Service層:

  先在CustomerService(接口)上編寫 updateCustomerById 方法

    public void updateCustomerById(Customer customer);

  然后在CustomerServiceImpl 實現類上實現這個方法:

    @Autowired
    private CustomerMapper customerMapper;
    
    @Override
    public void updateCustomerById(Customer customer) {
        customerMapper.updateCustomerById(customer);
    }

(3)Controller層:

    @Autowired
    private CustomerService customerService;
    
    @RequestMapping("/update")
    public String update(Customer customer) throws Exception{
        customerService.updateCustomerById(customer);
      //前端是ajax的請求,這邊返回響應response,把“customer”當成一個頁面,頁面的所有內容當成字符串返回回去
        return "customer";
    }

 

customer.jsp相對應的:

。。。。。。
<
button type="button" class="btn btn-primary" onclick="updateCustomer()">保存修改</button> 。。。。。。 <script type="text/javascript"> function updateCustomer() { $.post("<%=basePath%>customer/update.action",$("#edit_customer_form").serialize(),function(data){ alert("客戶信息更新成功!"); window.location.reload();//頁面重載 }); } </script>

 

7. 實現3:刪除客戶  

思路:和修改類似,提交到 controller 的是所選記錄的 id

 (1)DAO層:

   在 CustomerMapper.xml 編寫 刪除用戶信息 的sql語句

  <delete id="deleteCustomerById" parameterType="long">
        delete from customer where cust_id=#{id}
    </delete>

  在CustomerMapper.java 接口編寫deleteCustomerById方法:

  //刪除用戶信息
    public void deleteCustomerById(Long id);

(2)Service層:

  先在CustomerService(接口)上編寫 deleteCustomerById 方法:

    public void deleteCustomerById(Long id);

  然后在CustomerServiceImpl 實現類上實現這個方法:

  @Autowired
    private CustomerMapper customerMapper;
    
    @Override
    public void deleteCustomerById(Long id) {
        customerMapper.deleteCustomerById(id);
    }

(3)Controller層:

  @Autowired
    private CustomerService customerService;
    
    @RequestMapping("/delete")
    public String delete(Long id) throws Exception{
        customerService.deleteCustomerById(id);
        return "customer";
    }

 

 customer.jsp相對應的:

。。。。。。
<a href="#" class="btn btn-danger btn-xs" onclick="deleteCustomer(${row.cust_id})">刪除</a>
。。。。。。
<script type="text/javascript">
    function deleteCustomer(id) {
            if(confirm('確實要刪除該客戶嗎?')) {
                $.post("<%=basePath%>customer/delete.action",{"id":id},function(data){
                    alert("客戶刪除更新成功!");
                    window.location.reload();
                });
            }
        }
</script>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM