-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUserExcelReport.jsp
118 lines (104 loc) · 3.33 KB
/
UserExcelReport.jsp
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
<%--
Document : UserExcelReport
Created on : 16 Apr, 2017, 9:41:17 PM
Author : neha
--%>
<%@page import="java.util.*"%>
<%@page import="dto.UserDTO"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Export to Excel - Demo</title>
</head>
<body>
<%
String exportToExcel = request.getParameter("exportToExcel");
if (exportToExcel != null
&& exportToExcel.toString().equalsIgnoreCase("YES")) {
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "inline; filename="
+ "excel.xls");
}
%>
<%
List<UserDTO> listOfEmp = (List<UserDTO>) session.getAttribute("listOfEmp");
%>
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr style="background-color: #566D60;">
<th><center>
<font color="white">Employee Id</font>
</center></th>
<th><center>
<font color="white">Username</font>
</center></th>
<th><center>
<font color="white">Gender</font>
</center></th>
<th><center>
<font color="white">City</font>
</center></th>
<th><center>
<font color="white">Address</font>
</center></th>
<th><center>
<font color="white">Email</font>
</center></th>
<th><center>
<font color="white">Phone No.</font>
</center></th>
<th><center>
<font color="white">Department</font>
</center></th>
<th><center>
<font color="white">Designation</font>
</center></th>
<th><center>
<font color="white">Image</font>
</center></th>
</tr>
</thead>
<tbody>
<%
UserDTO userDTO=null;
Iterator iterator=listOfEmp.iterator();
while(iterator.hasNext())
{
userDTO=(UserDTO)iterator.next();
%>
<tr>
<td><%=userDTO.getEmpId()%> </td>
<td><%=userDTO.getUsername()%> </td>
<td><%=userDTO.getGender()%> </td>
<td><%=userDTO.getCity()%> </td>
<td><%=userDTO.getAddress()%></td>
<td><%=userDTO.getEmail()%> </td>
<td><%=userDTO.getPhoneNo()%> </td>
<td><%=userDTO.getDepartment()%> </td>
<td><%=userDTO.getDesignation()%> </td>
<td><img src="uploads/<%=userDTO.getImage()%>" height="50" width="100" alt="image not available"></td>
<td>
</tr>
<%
}
%>
</tbody>
</table>
<%
if (exportToExcel == null) {
%>
<h2> <a href="UserExcelReport.jsp?exportToExcel=YES">Export to Excel</a></h2>
<%
}
%>
<script>
$(function () {
$("#example1").dataTable();
});
</script>
</body>
</html>