国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

excel-從excel導入數據到數據庫

2019-11-08 02:04:23
字體:
來源:轉載
供稿:網友

0.需要使用jxl.jar 這個包

1.頁面是

function exportcomp(meetingId){ //導入參會人員 url = '$appServer/meeting/uploadPage.htm?meetingId='+meetingId; window.open(url,'導入','status,top=250,left=300,height=200,width=500,scrollbars=yes');} <a href="javascr2.然后是上傳Excel到服務器的頁面

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>文件導入</title><link href="$appServer/CSS/main.css" rel="stylesheet" type="text/css" /><script language="Javascript"> function checkfile(){ var path = document.uploadform.path.value; if(path==''){ alert('請選擇文件'); return false; } var i = path.lastIndexOf('.'); if(path.substring(i+1,path.length)!='xls'){ alert('只能上傳excel文件'); return false; } document.getElementById('waitbar').style.display = ""; return true; } function init(){ var t='$!ms'; if(t=='Y'){ alert('導入成功!'); var url = "$appServer/meeting/meetingDetail.htm?id=$!meetingId"; window.opener.location.href=url; window.close(); } } </script></head><body onload="init()"><br /><form name="uploadform" method="post" action="$appServer/meeting/upload.htm" enctype="multipart/form-data" onsubmit="return checkfile()"><div style="margin-top:15px; margin:0 auto; width:500px;"> <fieldset style=" width:400px; padding:10px;padding-top:5px;text-align:left; border:1px solid #ae0001; "> <legend style="width:50px; color:#cb2121; font-weight:bolder; ">信息上傳</legend><div> <div class="wai"> <label for="fbwh" class="tt1 tt">請選擇附件:</label> <div class="edit_r"> <input type="file" name="path" class=" sc-td" /></div> </div> <div class="wai"></div> <table border="1" width="400" align="center" cellspacing="0" cellpadding="4" style="border-collapse: collapse" height="80"style="display:none;" id="waitbar"> <tr> <td style="font-size:12px;line-height:200%" align=center>企業導入中... <marquee style="border:1px solid #000000" direction="right" width="340" scrollamount="5" scrolldelay="10" bgcolor="#fcf5f5"> <table cellspacing="1" cellpadding="0"> <tr height=8> <td bgcolor=#3399FF width=8></td> <td></td> <td bgcolor=#3399FF width=8></td> <td></td> <td bgcolor=#3399FF width=8></td> <td></td> <td bgcolor=#3399FF width=8></td> <td></td> <td bgcolor=#3399FF width=8></td> <td></td> </tr></table></marquee></td> </tr></table></div> <div class="edit_botton"> <input type="hidden" name="meetingId" value="$!meetingId"/> <input type="submit" value="上傳"><input type="reset" value="重置"></div> </fieldset></div>&nbsp;</div> </fieldset></div></form></body></html>

3.然后是

@RequestMapping(value = "/upload.htm") public ModelAndView upload(Long meetingId,HttpServletRequest request,Model model,UserAgent user) throws Exception { MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; MultipartFile multipartFile = multipartRequest.getFile("path"); String path=uploadService.UploadCompFile(multipartFile); List list=ExcelUtil.readexToMeetingNotice(new File(path)); for(int i=0;i<list.size();i++){ System.out.
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 常山县| 彰化县| 合山市| 浦县| 江川县| 全州县| 泾川县| 诸城市| 师宗县| 丁青县| 耿马| 台安县| 商丘市| 盐山县| 温泉县| 伊通| 大石桥市| 镇沅| 滁州市| 苏尼特左旗| 武威市| 江西省| 乡城县| 廊坊市| 隆德县| 平顺县| 台州市| 乌兰浩特市| 成武县| 迭部县| 巫山县| 增城市| 同江市| 乌拉特后旗| 泗洪县| 高清| 平潭县| 格尔木市| 萝北县| 三门县| 瑞昌市|