那我还没做过,应该用applet或servlet吧,比这个麻烦
解决方案 »
- 一个页面2次调用action生成jfreechart图形会出现2个图形一样的问题,怎么解决
- jsp如何绘图
- 关于jsp和servlet开发的编码问题 中文显示不出来
- 网页显示小问题
- jsp监听session对象
- 如何获取操作系统类型
- 请问抽象类和接口的区别
- 急求jspsmartupload组件!谢谢~~~
- 奇怪的乱码问题!急急!在线等待!
- tomcat + mysql 报Unsupported character encoding 'GBK'.; nested exception is java.
- 有关File.createTempFile("abc",".txt");的问题??
- 在weblogic7.0中怎么部署servlet?
能不能给我一个,谢谢先。
[email protected]
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="/err.jsp"%>
<jsp:useBean id="dbcon" scope="page" class="com.data.DBConnect"/>
<%
String vote_id=request.getParameter("vote_id");
String query="select choice.*,vote.vote_content,vote.vote_result from vote,choice ";
query+="where choice.vote_id='"+vote_id+"' and choice.vote_id=vote.vote_id";
ResultSet rs=dbcon.executeQuery(query);
double result=0;
String vote_content="";
if(rs.next()){
vote_content=rs.getString("vote_content");
result=rs.getDouble("vote_result");
%>
<style type="text/css">
<!--
.unnamed1 {
font-size: 14px;
}
-->
</style><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="34" colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" class="unnamed1">调查内容:<strong><%=vote_content%></strong> </td>
</tr>
<tr>
<td height="40" class="unnamed1">(目前共有<font color="#FF0000"><%=(int)result%></font>票!)</td>
</tr>
</table>
<hr> </td>
</tr>
<tr>
<td class="unnamed1"> </td>
<td width="480"> <table width="480" border="0" cellspacing="0" cellpadding="0">
<%
do{
String choice_content=rs.getString("choice_content");
double choice_result=rs.getDouble("choice_result");
%>
<tr>
<td width="110" height="40"><img src="/vote/red.gif" width="<%
if(result<1)
{
out.print(100);
}else{
out.print(100*choice_result/result);
}%>" height="20"></td>
<td width="190" class="unnamed1"><%=choice_content%></td>
<td width="180" class="unnamed1">已有<font color="#FF0000"><%=(int)choice_result%></font>票,
<%
if(result<1)
{
out.print("");
}else{
double kkkey=10000*choice_result/result;
out.print("占总数的"+(int)kkkey/100.00+"%");
}
%></td>
</tr>
<%}while(rs.next());
rs.close();
dbcon.destroy();
%>
</table>
<%}%></td>
<td> </td>
</tr>
<tr>
<td colspan="3"><hr></td>
</tr>
</table>