📄 showvote.jsp
字号:
<%@ page language="java" import="java.util.*" contentType="text/html;charset=GBK"%>
<%@ page import="java.text.*,votebean.*"%>
<%
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>
<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>
<%Questions question=(Questions)request.getAttribute("question");
Collection c=question.getItem();
Date startTime=question.getStartime();
Date endTime=question.getEndtime();
Date now=new Date();
String errorMsg="<font color=\"#FF0000\">投票过程正常中!</font>";
int status=1;
if(now.before(startTime)){
errorMsg="<font color=\"#FF0000\">投票尚未开始</font>";
status=0;
}else if(now.after(endTime)){
errorMsg="<font color=\"#FF0000\">投票已经结束</font>";
status=0;
}else if(question.getActive()==0){
errorMsg="<font color=\"#FF0000\">投票已经关闭</font>";
status=0;
}
NumberFormat nf=NumberFormat.getPercentInstance();
%>
<table width="80%" border="0" align="center"><tr>
<td bgcolor="#CCFFCC" colspan="3" align="center" ><b><%=errorMsg %>
</b></td>
</tr>
</table>
<table width="80%" border="0" align="center"><tr>
<td bgcolor="#C0C0C0" colspan="3" align="center" ><b><font color="#0000FF">投票结果</font>
</b></td>
</tr>
</table>
<table width="80%" border="0" align="center"><tr>
<td bgcolor="#FFCC99" colspan="3" align="center" ><u> <b>主题:<%=question.getTitle() %>
</b></u></td>
</tr>
<tr>
<td colspan="3" align="center" valign="middle">现在总票数<b><font color="#0000FF"><%=question.getVotecount()%></font>
</b></td>
</tr>
</table>
<table width="80%" border="0" align="center">
<%if((c!=null)&& (question.getVotecount()>0)){
Iterator iterator=c.iterator();
int i=1;
Item item=null;
while(iterator.hasNext()){
item=(Item)iterator.next();
%>
<tr>
<td align="left" bgcolor="#CCCCFF">[<%=i %>]
<%=item.getOptions() %>
</td>
<td align="left" bgcolor="#CCCCFF"><img border="0" height=14
width="<%=((double)item.getVote()*100/question.getVotecount()) %>">
<%=nf.format((double)item.getVote()/question.getVotecount()) %>
(<%=item.getVote() %>)</td>
</tr>
<%i++;}
}
%>
</table>
<table width="80%" border="0" align="center">
<tr>
<td align="center" valign="middle"><%if(status==1){ %><a href="servlet/ShowVoteServlet?id=<%=question.getId() %>&page=/admin/vote.jsp ">
我要投票</a>|
<%} %>
<a href="servlet/BrowseVoteServlet?type=admin">返回首页</a></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -