forked from maxliaops/Java_Web_Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwaichu.jsp
More file actions
165 lines (154 loc) · 6.68 KB
/
Copy pathwaichu.jsp
File metadata and controls
165 lines (154 loc) · 6.68 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
<%@ page language="java" pageEncoding="gb2312"%>
<%@ page import="java.util.*"%>
<jsp:directive.page import="com.hiernate.persistence.*"/>
<jsp:directive.page import="com.hiernate.util.HibernateUtil"/>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
<html:base />
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-bottom: 0px;
}
.STYLE1 {font-size: 9pt}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
.style2 {font-size: 9pt; color: #000000; }
-->
</style>
<link href="../CSS/style.css" rel="stylesheet" type="text/css">
</head>
<body background="../Images/main_center.jpg">
<table width="801" height="505" border="0" cellpadding="0" cellspacing="0" background="../Images/main_center.jpg">
<tr>
<td width="801" height="100%" valign="top">
<table width="100%" height="514" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" height="40" valign="bottom" background="../Images/main_top.JPG"><table width="100%" height="100%" border="0">
<tr>
<td class="STYLE1"> <img src="../Images/isexists.gif" width="16" height="16"/> <b>外出登记</b></td>
<td width="71" valign="middle">
<p><a href="#" class="STYLE1" onClick="Javascript:window.open('waichu_add.jsp','','width=580,height=360');return false">登记</a></p></td>
</tr>
</table></td>
</tr>
<tr>
<td height="451" colspan="2" valign="top"><br><br>
<table width="724" height="109" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="39" colspan="6" background="../Images/tiao.jpg"><table width="720" height="26" border="0">
<tr>
<td width="87"><div align="center" class="STYLE1">姓名</div></td>
<td width="110"><div align="center" class="STYLE1">所属部门</div></td>
<td width="136"><div align="center" class="STYLE1">开始时间</div></td>
<td width="121"><div align="center" class="STYLE1">终止时间</div></td>
<td width="152"><div align="center" class="STYLE1">外出原因</div></td>
<td width="88"><div align="center" class="STYLE1">是否销假</div></td>
</tr>
</table>
</td>
</tr>
<%
int iCurrPage = 1 ;
int pages = 1 ;
int allRecCount = 0 ;
int recPerPage = 5 ;
allRecCount = HibernateUtil.findWaichuCount(); //查询出总的记录数
pages = (allRecCount - 1)/recPerPage + 1 ; //计算出总的页数
if(pages == 0){ //对页数进行有效性处理,使页数的最小值是1
pages = 1;
}
String currPage = request.getParameter("currPage");
if(currPage != null && !currPage.equalsIgnoreCase("")){
iCurrPage = Integer.parseInt(currPage);
}
List listWaichu =HibernateUtil.finWaichu((iCurrPage - 1) * recPerPage, recPerPage);
if(listWaichu.isEmpty()){
out.println("暂无信息");
}
if(!listWaichu.isEmpty() && listWaichu.size()>0){
for(int i= 0;i<listWaichu.size();i++){
Waichu waichu = (Waichu)listWaichu.get(i);
session.setAttribute("Waichu",waichu);
%>
<tr>
<td width="93" height="31"><div align="center" class="STYLE1"><%=waichu.getName1()%></div></td>
<td width="111" ><div align="center" class="STYLE1"><%=waichu.getDepartment()%></div></td>
<td width="142"><div align="center" class="STYLE1"><%=waichu.getTime1()%></div></td>
<td width="125"><div align="center" class="STYLE1"><%=waichu.getTime2()%></div></td>
<td width="160" class="STYLE1">
<div align="center" class="STYLE1">
<a href="#" onClick="javascript:window.open('waichu_xianshi.jsp?ID=<%=waichu.getId()%>','','width=456,height=300');return false;" ><%=waichu.getContent()%></a>
</div>
</td>
<td width="93"><div align="center" class="STYLE1">
<%if(waichu.getState()==1){%> <!-- 如果waichu对象的state属性的值为"1",页面则显示"已销假" -->
已销假
<%}%>
<%if (waichu.getState()==0){
if(waichu.getName1().equals(application.getAttribute("un"))){
%> <!-- 如果waichu对象的state属性的值为"0",并且name属性值和当前用户名相同的情况下可以进行销假 -->
<a href="waichuCenter.jsp?currPage=<%=iCurrPage%>&&id=<%=waichu.getId()%>" onClick="return confirm('确定销假吗?');return false;">销假</a>
<%}else{%>
销假
<%}%>
</div></td>
</tr>
<%}}}%>
<tr>
<td height="39" colspan="6" background="../Images/tiao.jpg"><table width="719" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div align="right" class="STYLE1">
<% if(recPerPage < allRecCount){
String href = " <a href='waichu.jsp?currPage=";
StringBuffer sbf = new StringBuffer(); //制作分页条
if(iCurrPage > 1){
sbf.append(href+(iCurrPage - 1)+"'>上一页</a>"); //构造上一页
}
for(int i = 1 ; i <= pages ; i ++){
if(i == iCurrPage){
sbf.append(href+i+"'>["+i+"]</a>"); //追加串
}
else{
sbf.append(href+i+"'>"+i+"</a>");
}
}
if(iCurrPage < pages){
sbf.append(href+(iCurrPage + 1)+"'>下一页</a>"); //构造下一页
}
%>
<%out.print("当前页数:["+iCurrPage+"/"+pages+"]");%>
<%=sbf.toString()%>
<%} %>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table>
</body>