📄 vote.jsp
字号:
<%@ include file="include.inc"%>
<%@ page contentType="text/html; charset=gb2312" language="java" %>
<c:set var="all" value="SELECT 曹操+孙权+刘备+诸葛亮+未确定 as a FROM vote"/>
<c:set var="vote1" value="SELECT 曹操 as c FROM vote"/>
<c:set var="vote2" value="SELECT 孙权 as c FROM vote"/>
<c:set var="vote3" value="SELECT 刘备 as c FROM vote"/>
<c:set var="vote4" value="SELECT 诸葛亮 as c FROM vote"/>
<c:set var="vote5" value="SELECT 未确定 as c FROM vote"/>
<sql:query sql="${all}" var="queryall" dataSource="${vote}"/>
<c:forEach var="row" items="${queryall.rows}">
<c:set var="allcount" scope="page" value="${row.a}"/>
</c:forEach>
<html>
<head>
<title>表达式语言综合举例</title>
</head>
<body bgcolor="#FFFFFF">
<center>
三国中,你最喜欢的人物是:
<table width="75%" border="1">
<tr align="center">
<td width="17%" align="center">候选人</td>
<td width="83%" align="center">得票率</td>
</tr>
<tr>
<sql:query var="query" dataSource="${vote}">
SELECT 曹操 as c FROM vote
</sql:query>
<td><a href="vote_do.jsp?id=曹操">曹操 </a></td>
<c:forEach var="row" items="${query.rows}">
<td><img src="images/100.gif" height="16" width="${200*row.c/allcount}" align="texttop">
(${row.c}/${allcount})
</c:forEach>
</td>
</tr>
<tr>
<sql:query var="query" dataSource="${vote}">
SELECT 诸葛亮 as c FROM vote
</sql:query>
<td><a href="vote_do.jsp?id=诸葛亮">诸葛亮</a></td>
<c:forEach var="row" items="${query.rows}">
<td><img src="images/100.gif" height="16" width="${200*row.c/allcount}" align="texttop">
(${row.c}/${allcount} )
</c:forEach>
</td>
</tr>
<tr>
<sql:query var="query" dataSource="${vote}">
SELECT 刘备 as c FROM vote
</sql:query>
<td><a href="vote_do.jsp?id=刘备">刘备</a></td>
<c:forEach var="row" items="${query.rows}">
<td><img src="images/100.gif" height="16" width="${200*row.c/allcount}" align="texttop">
(${row.c}/${allcount} )
</c:forEach>
</td>
</tr>
<tr>
<sql:query var="query" dataSource="${vote}">
SELECT 孙权 as c FROM vote
</sql:query>
<td><a href="vote_do.jsp?id=孙权">孙权</a></td>
<c:forEach var="row" items="${query.rows}">
<td><img src="images/100.gif" height="16" width="${200*row.c/allcount}" align="texttop">
(${row.c}/${allcount} )
</c:forEach>
</td>
</tr>
<tr>
<sql:query var="query" dataSource="${vote}">
SELECT 未确定 as c FROM vote
</sql:query>
<td><a href="vote_do.jsp?id=未确定">未确定</a></td>
<c:forEach var="row" items="${query.rows}">
<td><img src="images/100.gif" height="16" width="${200*row.c/allcount}" align="texttop">
(${row.c}/${allcount} )
</c:forEach>
</td>
</tr>
</table>
<a href="vote_rec.jsp">查看投票人信息</a>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -