?? browse.jsp
字號:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.util.Collection,java.util.Iterator"%>
<%@ page import="com.wxpn.tutorial.servlet.Question"%>
<%@ page import="com.wxpn.tutorial.servlet.Item"%>
<%if (session.getAttribute("userName") == null) {
response.sendRedirect("/Vote/admin/login.jsp");
}%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>瀏覽投票項目</title>
<script type="text/javascript">
function confirmDelete(id){
if(window.confirm("您真的要徹底刪除嗎?")){
window.location="DeleteVoteServlet?id="+id;
}
}
</script>
</head>
<body>
<center>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" bgcolor="#0000FF" height="35" align=center><b><font
color="#FFFFFF">瀏覽投票項目 </font></b></td>
<td width="50%" bgcolor="#0000FF" height="35" align=center>[<a
href="admin/addVote.jsp"><b><font
color="#FF6600">添加投票項目</font></b></a>]|[<a href=/Vote/index.jsp><b><font
color="#FF6600">投票界面首頁</font></b></a>]</td>
</tr>
</table>
<table border="1" width="100%" bordercolorlight="#C0C0C0"
bordercolordark="#FFFFFF" cellspacing="0" cellpadding="0">
<tr>
<td width="5%" bgcolor="#FCCCCC">編號</td>
<td width="40%" bgcolor="#FCCCCC">主題</td>
<td width="10%" bgcolor="#FCCCCC">投票總數</td>
<td width="12%" bgcolor="#FCCCCC">開始時間</td>
<td width="12%" bgcolor="#FCCCCC">結束時間</td>
<td width="10%" bgcolor="#FCCCCC">狀態</td>
<td width="10%" bgcolor="#FCCCCC"> </td>
</tr>
<%if (request.getAttribute("c") == null) {
%>
<tr>
<td width="75%" colspan=5 bgcolor="#FCFCFC" align=center>還沒有任何投票項目。</td>
</tr>
<%} else {
Collection c = (Collection) request.getAttribute("c");
if (c == null) {
%>
<tr>
<td width="75%" colspan=5 bgcolor="#FCFCFC" align=center>還沒有任何投票項目。</td>
</tr>
<%} else {
int totalPageNum = ((Integer) (request
.getAttribute("totalPageNum"))).intValue();
int currentPage = 1;
if (request.getParameter("page") != null) {
currentPage = Integer.parseInt(request
.getParameter("page"));
}
Iterator iterator = c.iterator();
while (iterator.hasNext()) {
Question question = (Question) iterator.next();
%>
<tr>
<td width="5%" bgcolor="#FCFCFC"><a
href="ShowVoteServlet?page=showvote.jsp&id=<%=question.getId()%>"><%=question.getId()%></a></td>
<td width="40%" bgcolor="#FCFCFC"><a
href="ShowVoteServlet?page=showvote.jsp&id=<%=question.getId()%>"><%=question.getTitle()%></a></td>
<td width="10%" bgcolor="#FCFCFC"><%=question.getVotecount()%></td>
<td width="12%" bgcolor="#FCFCFC"><%=question.getStrStartime()%></td>
<td width="12%" bgcolor="#FCFCFC"><%=question.getStrEndtime()%></td>
<td width="10%" bgcolor="#FCFCFC"><%=question.getActive() == 0 ? "已關閉"
: "正常"%></td>
<td width="10%" bgcolor="#FCFCFC"><a
href="EditVoteServlet?id=<%=question.getId()%>">修改</a>|<a
href="javascript:confirmDelete(<%=question.getId()%>)">刪除</a></td>
</tr>
<%}%>
<tr>
<td width="75%" colspan=8 align=right height="50" bgcolor="#EFEFEF"><%if (totalPageNum > 1) {%>
<a href="BrowseVoteServlet?type=admin&page=1">首頁</a>|<a
href="BrowseVoteServlet?type=admin&page=<%=currentPage>1?currentPage-1:1 %>">上一頁</a>|<a
href="BrowseVoteServlet?type=admin&page=<%=currentPage<totalPageNum?currentPage+1:totalPageNum %>">下一頁</a>|<a
href="BrowseVoteServlet?type=admin&page=<%=totalPageNum%>">末頁</a> <%}
%>
</tr>
<%}
}
%>
<tr>
<td width="75%" colspan=8 align=center height="50" bgcolor="#EFEFEF">
[<a href="admin/addVote.jsp">添加投票項目</a>]
</tr>
</table>
</center>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -