votes.jsp
来自「JSP+ORACLE网站开发实例(下).rar」· JSP 代码 · 共 81 行
JSP
81 行
<%@ include file="rscoon.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>投票结果</title>
<style type=text/css>
<!--
BODY{
margin:0px;
FONT-SIZE: 12px;
FONT-FAMILY: "宋体", "Verdana", "Arial", "Helvetica", "sans-serif";
scrollbar-face-color: #DEE3E7;
scrollbar-highlight-color: #FFFFFF;
scrollbar-shadow-color: #DEE3E7;
scrollbar-3dlight-color: #D1D7DC;
scrollbar-arrow-color: #006699;
scrollbar-track-color: #EFEFEF;
scrollbar-darkshadow-color: #98AAB1;
}
table { border:0px; }
td { font:normal 12px 宋体; }
img { vertical-align:bottom; border:0px; }
a { font:normal 12px 宋体; color:#000000; text-decoration:none; }
a:hover { color:#428EFF;text-decoration:underline; }
.sec_menu { border-left:1px solid white; border-right:1px solid white; border-bottom:1px solid white; overflow:hidden; background:#D6DFF7; }
.menu_title { }
.menu_title span { position:relative; top:2px; left:8px; color:#215DC6; font-weight:bold; }
.menu_title2 { }
.menu_title2 span { position:relative; top:2px; left:8px; color:#428EFF; font-weight:bold; }
input,select,Textarea{
font-family:宋体,Verdana, Arial, Helvetica, sans-serif; font-size: 12px;}
}
-->
</style>
</head>
<body>
<%request.setCharacterEncoding("GB2312");
String action=request.getParameter("action");
String rv=request.getParameter("rv");
String voteID=request.getParameter("voteID");
String statid=request.getParameter("statid");
if(action.equals("poll")){
if(rv==null){
out.print("<script>alert('请选择你所投的对象,不能投空票');history.back();</script>");
}else{
stmt.executeUpdate("update scott.votes set counts=counts+1 where voteid='"+rv+"'");
%>
<script>alert('谢谢您的投票,有了您的支持我们将更努的做好服务');history.back();</script>
<%}
}
if(action.equals("look")){
String sqlname="select sum(counts) as total from scott.votes where fromid=16";
ResultSet rs=stmt.executeQuery(sqlname);
if(rs.next()){
%>
<table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
<tr >
<td height="33" colspan="4" align="center" background="images/dhbg2.gif">
目前共有<font color="#ff0000"><%=rs.getString("total")%></font>人参予了投票</td>
</tr>
<%
String sqlname1="select * from scott.votes where fromid=16";
ResultSet rst=stmt.executeQuery(sqlname1);
while(rst.next()){
%>
<tr>
<td width="25%" height="20"><%=rst.getString("votetitle")%> </td>
<td width="43%" height="20"> 票数 </td>
<td width="32%" height="20"> <font color="#FCBF50"><%=rst.getString("counts")%></font> </td>
</tr>
<%
}
}
out.print("<tr><td height=20 colspan=4 align=center>【谢谢您的投票】<br><a href='javascript:window.close()'>关闭</a></td></tr></table>");
}%>
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?