Spring Mvc + Easyui中根据查询结果导出文件

本文介绍了一个SpringMvc结合Easyui的项目中,如何根据查询条件从前台页面导出CSV文件的过程。主要涉及前台表单提交,后台接收查询参数,查询数据并生成CSV的步骤。在实现过程中,遇到ajax请求后台时回调函数报错的问题,尚未解决。
摘要由CSDN通过智能技术生成

项目是典型的SpringMvc + Easyui,需求是前台页面根据查询条件导出生成CSV文件。

 

基本流程是:前台页面通过表单提交的方式,请求后台,后台接受到查询参数,根据查询参数查询到数据集合,最后导出生成CSV文件。(用ajax请求后台时遇到一点问题,回调函数一直报错,有待研究)

1、前台页面效果图:

Spring Mvc + Easyui中根据查询结果导出文件

2、前台页面代码:

Java
<div class="easyui-layout" data-options="fit:true">
    <div class="easyui-panel" data-options="region:'north'" style="height:40px;">
        <form id="formQuery" method="post">
        <input type="hidden" id = "serverId" />
            <table cellpadding="4">
                <tr>
                   <td><spring:message code="筛选时间" /></td>
                   <td><input class="easyui-datebox" id="countTime" data-options="editable:false,width:140" /></td>
                   <td><a href="javascript:reloadCountData()" class="easyui-linkbutton" iconCls="icon-search"><spring:message code="筛选" /></a></td>
                   <td><a href="javascript:exportData()" class="easyui-linkbutton" iconCls="icon-save"><spring:message code="导出" /></a></td>
                </tr>  
            </table>
        </form> 
    </div>
    <div data-options="region:'center'" style="width: 100%;height: 100%">
       <table id="gridOnline" class="easyui-datagrid" data-options="fit:true,pagination:true,rownumbers:true,pageSize:20,loader:loadCountData" >
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值