uploadexcel.jsp
5.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="<%=basePath%>">
<!-- jsp文件头和头部 -->
<%@ include file="../../system/index/top.jsp"%>
<style>
.ace-file-input .ace-file-container{
display: block;
position: absolute;
top: 0;
left: 0;
right: 0;
height: 40px;
background-color: #ffffff;
border: 1px solid #d5d5d5;
cursor: pointer;
-webkit-box-shadow: none;
box-shadow: none;
-webkit-transition: all 0.15s;
-o-transition: all 0.15s;
transition: all 0.15s;
}
.ace-file-input .ace-file-container:before{
display: inline-block;
content: attr(data-title);
position: absolute;
right: 0;
top: 0;
bottom: 0;
line-height: 34px;
text-align: center;
padding: 0 8px;
background-color: #3bc2d6;
color: #FFF;
font-size: 11px;
font-weight: bold;
border: 2px solid #FFF;
border-left-width: 4px;
-webkit-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
}
.ace-file-input .ace-file-container .ace-file-name {
display: inline-block;
height: 38px;
max-width: 80%;
white-space: nowrap;
overflow: hidden;
line-height: 38px;
color: #888888;
font-size: 13px;
vertical-align: top;
position: static;
padding-left: 36px;
}
.ace-file-input .ace-file-container .ace-icon {
display: inline-block;
position: absolute;
left: 0;
top: 0;
bottom: 0;
line-height: 34px;
width: 36px;
text-align: center;
font-family: FontAwesome;
font-size: 13px;
border: 2px solid #FFF;
color: #FFF;
-webkit-transition: all 0.1s;
-o-transition: all 0.1s;
transition: all 0.1s;
background-color: #3bc2d6;
}
.ace-file-input .ace-file-container .ace-file-name:after {
display: inline-block;
content: attr(data-title);
}
</style>
</head>
<body class="no-skin">
<!-- /section:basics/navbar.layout -->
<div class="main-container" id="main-container">
<!-- /section:basics/sidebar -->
<div class="main-content">
<div class="main-content-inner">
<div class="page-content">
<div class="row">
<div class="col-xs-12">
<form action="student/readExcel.do?SCHOOL_ID=${pd.SCHOOL_ID }&CLASS_ID=${pd.CLASS_ID}&TERM_ID=${pd.TERM_ID}" name="Form" id="Form" method="post" enctype="multipart/form-data">
<div id="zhongxin">
<input type="hidden" name="SCHOOL_ID" id="SCHOOL_ID" value="${pd.SCHOOL_ID}"/>
<input type="hidden" name="CLASS_ID" id="CLASS_ID" value="${pd.CLASS_ID}"/>
<input type="hidden" name="TERM_ID" id="TERM_ID" value="${pd.TERM_ID}"/>
<table style="width:95%;" >
<tr>
<td style="padding-top: 20px;"><input type="file" id="excel" name="excel" style="width:50px;" onchange="fileType(this)" /></td>
</tr>
<tr>
<td style="text-align: center;padding-top: 10px;">
<a class="btn btn-mini btn-primary" style="background-color:#3bc2d6 !important;border-color:#3bc2d6 !important;width:200px; height:50px;line-height:50px;font-size:18px;margin-top:5%;padding:0" onclick="save();">导入</a>
<a class="btn btn-mini btn-primary" style="background-color:#87b87f !important;border-color:#87b87f !important;width:200px; height:50px;line-height:50px;font-size:18px;margin-top:5%;padding:0" href="static/files/Template.xls" target="_blank" >下载模板</a>
</td>
</tr>
</table>
</div>
<div id="zhongxin2" class="center" style="display:none"><br/><img src="static/images/jzx.gif" /><br/><h4 class="lighter block green"></h4></div>
</form>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
<!-- /.page-content -->
</div>
</div>
<!-- /.main-content -->
</div>
<!-- /.main-container -->
<!-- basic scripts -->
<!-- 页面底部js¨ -->
<%@ include file="../../system/index/foot.jsp"%>
<!-- ace scripts -->
<script src="static/ace/js/ace/ace.js"></script>
<!-- 上传控件 -->
<script src="static/ace/js/ace/elements.fileinput.js"></script>
<!--提示框-->
<script type="text/javascript" src="static/js/jquery.tips.js"></script>
<script type="text/javascript">
$(function() {
//上传
$('#excel').ace_file_input({
no_file:'请选择EXCEL ...',
btn_choose:'选择',
btn_change:'更改',
droppable:false,
onchange:null,
thumbnail:false, //| true | large
whitelist:'xls|xls',
blacklist:'gif|png|jpg|jpeg'
//onchange:''
});
});
//保存
function save(){
if($("#excel").val()=="" || document.getElementById("excel").files[0] =='请选择xls格式的文件'){
$("#excel").tips({
side:3,
msg:'请选择文件',
bg:'#AE81FF',
time:3
});
return false;
}
$("#Form").submit();
$("#zhongxin").hide();
$("#zhongxin2").show();
}
function fileType(obj){
var fileType=obj.value.substr(obj.value.lastIndexOf(".")).toLowerCase();//获得文件后缀名
if(fileType != '.xls'){
$("#excel").tips({
side:3,
msg:'请上传xls格式的文件',
bg:'#AE81FF',
time:3
});
$("#excel").val('');
document.getElementById("excel").files[0] = '请选择xls格式的文件';
}
}
</script>
</body>
</html>