jeesite的Excel表格导入

本文详细介绍了如何在Jeesite框架下实现Excel表格数据的导入功能,包括在JSP页面添加隐藏域和导入按钮,创建实体类,编写Controller和Service层的代码,以及处理关联的DAO和XML配置文件。
摘要由CSDN通过智能技术生成

在JSP页面中

	<script type="text/javascript">
			$(document).ready(function() {
   
	            $("#btnImport").click(function(){
   
	                $.jBox($("#importBox").html(), {
   title:"导入数据", buttons:{
   "关闭":true},
	                    bottomText:"导入文件不能超过5M,仅允许导入“xls”或“xlsx”格式文件!"});
	            });
			});
	</script>
在body中添加隐藏域
<body>
	<div id="importBox" class="hide">
		<form id="importForm" action="${ctx}/basic/personInfo/import"
			  method="post" enctype="multipart/form-data" class="form-search"
			  style="padding-left: 20px; text-align: center;"
			  onsubmit="loading('正在导入,请稍等...');">
			<br />
			<input id="uploadFile" name="file" type="file"
				   style="width: 330px" />
			<br /> <br />
			<input id="btnImportSubmit"
				   class="btn btn-primary" type="submit" value="   导    入   " /> <a
				href="${ctx}/basic/personInfo/import/template">下载模板</a>
		</form>
	</div>
添加导入按钮
<li class="btns"><input id="btnImport" class="btn btn-primary" type="button" value="导入"/></li>

实体类中

 * 人员信息Entity
 * 
 * @author zhaojf
 * @version 2018-11-23
 */
public class PersonInfo extends DataEntity<PersonInfo> {
   

	private static final long serialVersionUID = 1L;
	private String name; // 姓名
	private RushDisposalStation station; // 归属垃圾站
	private PersonType type; // 人员类别
	private String phone; // 电话
	private String nativePlace; // 贯籍
	private String card;  //身份证号码
	private String address;  //家庭住址

	public PersonInfo() {
   
		super();
	}

	public PersonInfo(String id) {
   
		super(id)
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值