⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 browse.jsp

📁 用jsp编写的网上投票系统
💻 JSP
字号:
<%@ page language="java" import="java.util.*" pageEncoding="GBK" contentType="text/html;charset=GBK"%>
<%@page import="votebean.*" %>
<% if(session.getAttribute("userName")==null){
response.sendRedirect("/vote/admin/login.jsp");
}
 %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>浏览投票项目</title>
    <script type="text/javascript">
    function confirmDelete(id){
    	if(windows.confirm("您想删除彻底么")){
    		windows.location="DeleteVoteServlet?id="+id;
    	}
    }
    </script>
    
	<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">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
  <center>
  <table border="0" width="100%" cellspacing="0" cellpadding="0">
  	<tr>
  		<td width="50%" bgcolor="#000FF" height="35" align="center"><b><font color="#FFFFFF">浏览投票项目
  		</font></b></td>
  		<td width="50%" bgcolor="#000FF" height="35" align="center">[<a href="admin/addvote.jsp"><b><font
  		color="#FF6600">添加投票项目
  		</font></b></a>]|[<a href=/vote/admin/index.jsp><b><font color="#FF6600">投票界面首页</font></b></a>]</td>
  		</tr>
  </table>
  <table border="1" width="100%" bordercolorlight="#C0C0C0" bodercolordark="#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">&nbsp;</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()){
  		Questions question=(Questions)iterator.next();
   %>
   <tr>
   <td width="5%" bgcolor="#FCFCFC"><a href="servlet/ShowVoteServlet?id=<%=question.getId() %>&page=showvote.jsp %>"><%=question.getId()%>
   	</a></td>
   	<td width="40%" bgcolor="#FCFCFC"><a href="servlet/ShowVoteServlet?page=/admin/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?"closed":"on" %></td>
   	<td width="10%" bgcolor="#FCFCFC"><a href="servlet/EditVoteServlet?id=<%=question.getId() %>">修改</a>|<a href="servlet/DeleteVoteServlet?id=<%= question.getId() %>">删除</a></td>
   	</tr>
   	<% } %>
   	<tr>
   	   <td width="75%" colspan=8 align=right height="50" bgcolor="#EFEFEF"><%if ( totalPageNum>1){ %>
   	   <a href="servlet/BrowseVoteServlet?type=admin&page=1">首页</a>|<a href="servlet/BrowseVoteServlet?type=admin&page=<%=currentPage>1?currentPage-1:1 %>">上一页</a>|
   	  <a href="servlet/BrowseVoteServlet?type=admin&page=<%=currentPage<totalPageNum?currentPage+1:totalPageNum %>"> 下一页</a>|
   	  <a href="servlet/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>]
   	 </td>
   	 </tr>
   	 
  </table>
  </center>
  </body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -